From 375ded5e814f5e7d1f2dc089bda5f3952492eae5 Mon Sep 17 00:00:00 2001 From: Benjamin Palko Date: Sat, 19 Jul 2025 22:08:28 -0400 Subject: [PATCH] create icon type --- modules/bar/components/Workspace.qml | 25 ++++++++++++------------- styled/Icon.qml | 21 +++++++++++++++++++++ 2 files changed, 33 insertions(+), 13 deletions(-) create mode 100644 styled/Icon.qml diff --git a/modules/bar/components/Workspace.qml b/modules/bar/components/Workspace.qml index e08af3d..b28e61f 100644 --- a/modules/bar/components/Workspace.qml +++ b/modules/bar/components/Workspace.qml @@ -1,7 +1,9 @@ import QtQuick import QtQuick.Controls +import QtQuick.Effects import Quickshell.Hyprland import "../../../config" +import "../../../styled/" Item { id: workspace @@ -20,7 +22,7 @@ Item { radius: Dimensions.radius states: State { name: "hovered" - when: button.hovered + when: mouseArea.containsMouse PropertyChanges { rectangle { color: Theme.palette.primary @@ -39,25 +41,21 @@ Item { } } - Button { - id: button + Icon { + id: icon + + source: "/home/baobeld/dotfiles/quickshell/assets/triangle.svg" + anchors.centerIn: parent - - verticalPadding: Dimensions.workspace.verticalPadding - horizontalPadding: Dimensions.workspace.horizontalPadding - - background: undefined - - icon.source: "/home/baobeld/dotfiles/quickshell/assets/triangle.svg" - icon.color: Theme.palette.basecontent + size: Dimensions.workspace.iconSize states: State { name: "active" when: workspace.modelData.active PropertyChanges { - button { + icon { rotation: 180 - icon.color: button.hovered ? Theme.palette.basecontent : Theme.palette.primary + color: mouseArea.containsMouse ? Theme.palette.basecontent : Theme.palette.primary } } } @@ -85,6 +83,7 @@ Item { anchors.fill: parent cursorShape: Qt.PointingHandCursor + hoverEnabled: true onClicked: workspace.modelData.activate() } } diff --git a/styled/Icon.qml b/styled/Icon.qml new file mode 100644 index 0000000..2c19f55 --- /dev/null +++ b/styled/Icon.qml @@ -0,0 +1,21 @@ +import QtQuick +import QtQuick.Effects +import "../config/" + +Image { + id: root + + property int size: 18 + property color color: Theme.palette.basecontent + + width: size + height: size + + MultiEffect { + id: effect + source: root + anchors.fill: root + colorization: 1.0 + colorizationColor: color + } +}