switch workspace to clickable

This commit is contained in:
Benjamin Palko 2025-07-22 13:17:59 -04:00
parent 903803bdfd
commit 85dbc986af

View file

@ -1,89 +1,56 @@
import QtQuick import QtQuick
import QtQuick.Controls
import QtQuick.Effects
import Quickshell.Hyprland import Quickshell.Hyprland
import "../../../../config" import "../../../../config"
import "../../../../styled/" import "../../../../styled/"
Item { Loader {
id: workspace
required property HyprlandWorkspace modelData required property HyprlandWorkspace modelData
visible: modelData.id > 0 active: modelData.id > 0
width: Dimensions.workspace.width sourceComponent: workspace
height: Dimensions.workspace.height property Component workspace: Clickable {
id: clickable
Rectangle { width: Dimensions.workspace.width
id: rectangle height: Dimensions.workspace.height
anchors.fill: parent
color: Theme.palette.base100 onClicked: modelData.activate()
radius: Dimensions.radius
states: State { Icon {
name: "hovered" id: icon
when: mouseArea.containsMouse
PropertyChanges { source: "/home/baobeld/dotfiles/quickshell/assets/triangle.svg"
rectangle {
color: Theme.palette.primary anchors.centerIn: parent
size: Dimensions.workspace.iconSize
states: State {
name: "active"
when: modelData.active
PropertyChanges {
icon {
rotation: 180
color: clickable.hovered ? Theme.palette.basecontent : Theme.palette.primary
}
}
}
transitions: Transition {
from: ""
to: "active"
reversible: true
ParallelAnimation {
RotationAnimation {
duration: 200
easing.type: Easing.InOutCubic
}
ColorAnimation {
duration: 200
easing.type: Easing.OutCubic
}
} }
} }
} }
transitions: Transition {
from: ""
to: "hovered"
reversible: true
ColorAnimation {
properties: "color"
duration: 200
easing.type: Easing.InOutCubic
}
}
}
Icon {
id: icon
source: "/home/baobeld/dotfiles/quickshell/assets/triangle.svg"
anchors.centerIn: parent
size: Dimensions.workspace.iconSize
states: State {
name: "active"
when: workspace.modelData.active
PropertyChanges {
icon {
rotation: 180
color: mouseArea.containsMouse ? Theme.palette.basecontent : Theme.palette.primary
}
}
}
transitions: Transition {
from: ""
to: "active"
reversible: true
ParallelAnimation {
RotationAnimation {
duration: 200
easing.type: Easing.InOutCubic
}
ColorAnimation {
duration: 200
easing.type: Easing.OutCubic
}
}
}
}
MouseArea {
id: mouseArea
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
hoverEnabled: true
onClicked: workspace.modelData.activate()
} }
} }