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

View file

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