move workspaces to icon button

This commit is contained in:
Benjamin Palko 2025-08-29 15:59:17 -04:00
parent c5ac7fe773
commit 1d350e35d6
2 changed files with 41 additions and 56 deletions

View file

@ -1,70 +1,43 @@
pragma ComponentBehavior: Bound
import qs.components
import qs.config
import qs.constants
import qs.widgets
import QtQuick
import Quickshell.Hyprland
Loader {
StyledIconButton {
id: root
required property HyprlandWorkspace modelData
active: modelData.id > 0
required property HyprlandWorkspace workspace
sourceComponent: workspace
property Component workspace: StyledButton {
id: clickable
onClicked: root.modelData.activate()
content: Text {
id: icon
font.family: Theme.lucide.font.family
font.pixelSize: Dimensions.workspace.iconSize
font.bold: true
text: Icons.triangle
font.bold: true
font.pixelSize: 17
padding: 8
color: Theme.palette.basecontent
onClicked: root.workspace.activate()
states: [
State {
name: "focused"
when: root.modelData.focused
when: root.workspace.focused
PropertyChanges {
icon {
root {
rotation: 180
color: clickable.hovered ? Theme.palette.basecontent : Theme.palette.primary
color: root.hovered ? Theme.palette.basecontent : Theme.palette.primary
border.color: Theme.palette.secondary
}
}
},
State {
name: "active"
when: root.modelData.active
when: root.workspace.active
PropertyChanges {
icon {
root {
text: Icons.triangleDashed
rotation: 180
color: clickable.hovered ? Theme.palette.basecontent : Theme.palette.primary
color: root.hovered ? Theme.palette.basecontent : Theme.palette.primary
}
}
}
]
transitions: Transition {
reversible: true
ParallelAnimation {
RotationAnimation {
duration: 200
easing.type: Easing.InOutCubic
}
ColorAnimation {
duration: 200
easing.type: Easing.OutCubic
}
}
}
}
}
}

View file

@ -1,3 +1,5 @@
pragma ComponentBehavior: Bound
import qs.config
import QtQuick
import QtQuick.Layouts
@ -12,6 +14,16 @@ RowLayout {
model: Hyprland.workspaces
Workspace {}
Loader {
id: loader
required property HyprlandWorkspace modelData
active: modelData.id > 0
sourceComponent: workspace
property Component workspace: Workspace {
workspace: loader.modelData
}
}
}
}