nixos/config/quickshell/Workspaces.qml

63 lines
1.6 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
2025-01-10 09:26:43 +04:00
RowLayout {
2025-01-09 23:04:06 +04:00
id: workspaceList
2025-01-10 09:26:43 +04:00
height: 30
spacing: 0
2025-01-09 23:04:06 +04:00
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
2025-01-10 09:26:43 +04:00
Repeater {
model: workspaceArray
delegate: Rectangle {
2025-01-09 23:04:06 +04:00
id: workspace
2025-01-10 09:26:43 +04:00
width: 20
height: parent.height
color: (modelData.active) ? "#222222" : (modelData.visible) ? "#444444" : "#000000"
Text {
color: "#FFFFFF"
anchors.centerIn: parent
text: modelData.text
}
2025-01-09 23:04:06 +04:00
}
}
2025-01-10 09:26:43 +04:00
2025-01-09 13:42:16 +04:00
}
2025-01-10 09:26:43 +04:00
/* ListView { */
/* 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 */
/* })) */
/* model: workspaceArray */
/* anchors.top: parent.top */
/* anchors.centerIn: parent */
/* height: parent.height */
/* width: 60 */
/* spacing: 2 */
/* delegate: Item { */
/* width: Math.max((modelData.active) ? 50 : 40, 50) */
/* height: 10 */
/* Rectangle { */
/* id: workspace */
/* width: (modelData.active) ? 50 : 40 */
/* height: 10 */
/* radius: height / 2 */
/* border.width: 1 */
/* border.color: (modelData.active) ? "#FFF8C8DC" : (modelData.visible) ? "#3399FF" : "#FFFFFF" */
/* anchors.centerIn: parent */
/* } */
/* } */
/* } */