nixos/config/quickshell/Workspaces.qml

54 lines
1.3 KiB
QML
Raw Normal View History

2025-01-07 22:37:12 +04:00
import QtQuick
import QtQuick.Layouts
2025-01-08 11:17:54 +04:00
import Quickshell
import Quickshell.Hyprland
2025-01-07 22:37:12 +04:00
ListView {
2025-01-09 23:04:06 +04:00
id: workspaceList
property var workspaceArray: Array.from({ length: 10}, (_, i) => ({
id: i + 1,
text: i + 1,
visible: Hyprland.workspaces.values.some(e => e.id === i + 1),
active: Hyprland.focusedMonitor.activeWorkspace.id === i + 1
}))
2025-01-09 13:42:16 +04:00
model: workspaceArray
anchors.top: parent.top
2025-01-10 19:52:14 +04:00
height: 135
width: 60
2025-01-10 18:37:18 +04:00
spacing: 5
2025-01-10 19:52:14 +04:00
interactive: false
delegate: Item {
2025-01-10 18:37:18 +04:00
width: Math.max((modelData.active) ? 70 : 40, 70)
height: 10
Rectangle {
2025-01-09 23:04:06 +04:00
id: workspace
2025-01-10 18:37:18 +04:00
width: (modelData.active) ? 60 : 45
height: 10
radius: height / 2
2025-01-10 09:33:54 +04:00
border.width: 2
color: (modelData.active) ? "#0099DD" : (modelData.visible) ? "#227722" : "#222222"
/* border.color: (modelData.active) ? "#AACCFF" : (modelData.visible) ? "#3399FF" : "#FFFFFF" */
border.color: "#999999"
anchors.centerIn: parent
2025-01-09 23:04:06 +04:00
}
2025-01-10 21:12:20 +04:00
MouseArea {
id: mouseArea
anchors.fill: parent
hoverEnabled: true
onClicked: {
Hyprland.dispatch("workspace " + modelData.id)
}
}
states: State {
name: "hovered"; when: (mouseArea.containsMouse && !modelData.active)
PropertyChanges {
target: workspace
height: 10
width: 50
}
}
2025-01-09 23:04:06 +04:00
}
2025-01-09 13:42:16 +04:00
}