2026-01-15 01:13:17 +01:00
|
|
|
pragma ComponentBehavior: Bound
|
|
|
|
|
import Quickshell.Hyprland
|
|
|
|
|
import QtQuick
|
2026-01-19 12:45:35 +01:00
|
|
|
import qs
|
|
|
|
|
import qs.settings
|
|
|
|
|
import qs.reusables
|
2026-01-15 01:13:17 +01:00
|
|
|
|
2026-01-26 18:20:36 +01:00
|
|
|
Rectangle {
|
2026-01-15 01:13:17 +01:00
|
|
|
id: root
|
2026-01-26 18:20:36 +01:00
|
|
|
color: Colors.surfaceContainer
|
|
|
|
|
|
|
|
|
|
implicitWidth: workspaceRow.implicitWidth + 10
|
|
|
|
|
implicitHeight: Settings.config.barHeight - 10
|
|
|
|
|
radius: Settings.config.barHeight / 2
|
2026-01-21 18:11:12 +01:00
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
2026-01-23 16:34:15 +01:00
|
|
|
property var screen: screen
|
2026-01-15 01:13:17 +01:00
|
|
|
Row {
|
|
|
|
|
id: workspaceRow
|
|
|
|
|
anchors.centerIn: parent
|
2026-01-16 14:44:10 +01:00
|
|
|
spacing: 10 // Slightly increase spacing between workspace buttons
|
2026-01-15 01:13:17 +01:00
|
|
|
|
|
|
|
|
Repeater {
|
|
|
|
|
id: wsRepeater
|
|
|
|
|
model: Hyprland.workspaces
|
|
|
|
|
Rectangle {
|
|
|
|
|
id: workspaceNumber
|
2026-01-21 18:11:12 +01:00
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
2026-01-16 14:44:10 +01:00
|
|
|
radius: 20
|
2026-01-15 17:43:03 +01:00
|
|
|
property bool isOnMon: {
|
|
|
|
|
if (!modelData)
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
if (!modelData.monitor)
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
if (!root.screen)
|
|
|
|
|
return false;
|
|
|
|
|
return modelData.monitor.name === root.screen.name;
|
|
|
|
|
}
|
|
|
|
|
|
2026-01-15 01:13:17 +01:00
|
|
|
required property var modelData
|
2026-01-16 14:44:10 +01:00
|
|
|
width: isOnMon ? Settings.config.barHeight - Settings.config.barHeight / 2 : 0
|
|
|
|
|
height: isOnMon ? Settings.config.barHeight - Settings.config.barHeight / 2 : 0
|
|
|
|
|
color: "transparent"
|
2026-01-15 01:13:17 +01:00
|
|
|
|
|
|
|
|
CustomText {
|
|
|
|
|
anchors.centerIn: workspaceNumber
|
|
|
|
|
text: parent.modelData.id
|
2026-01-26 18:20:36 +01:00
|
|
|
color: Colors.onSurfaceColor
|
|
|
|
|
opacity: workspaceNumber.modelData.focused ? 1 : 0.5
|
2026-01-15 01:13:17 +01:00
|
|
|
}
|
|
|
|
|
MouseArea {
|
|
|
|
|
anchors.fill: parent
|
|
|
|
|
acceptedButtons: Qt.LeftButton
|
2026-01-18 01:29:27 +01:00
|
|
|
cursorShape: Qt.PointingHandCursor
|
2026-01-15 01:13:17 +01:00
|
|
|
onClicked: {
|
|
|
|
|
parent.modelData.activate();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|