2026-01-15 01:13:17 +01:00
|
|
|
pragma ComponentBehavior: Bound
|
|
|
|
|
import Quickshell.Hyprland
|
|
|
|
|
import QtQuick
|
2026-02-07 23:50:10 +01:00
|
|
|
import QtQuick.Layouts
|
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
|
|
|
|
|
|
2026-02-09 20:35:38 +01:00
|
|
|
implicitWidth: workspaceRow.implicitWidth + 10
|
2026-02-06 14:05:29 +01:00
|
|
|
implicitHeight: Settings.config.barHeight - 10
|
2026-01-26 18:20:36 +01:00
|
|
|
radius: Settings.config.barHeight / 2
|
2026-01-23 16:34:15 +01:00
|
|
|
property var screen: screen
|
2026-02-08 00:37:29 +01:00
|
|
|
Row {
|
2026-01-15 01:13:17 +01:00
|
|
|
id: workspaceRow
|
|
|
|
|
anchors.centerIn: parent
|
2026-02-03 00:19:20 +01:00
|
|
|
spacing: 5 // 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-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-02-09 22:54:58 +01:00
|
|
|
width: !modelData.focused ? 20 : 40
|
2026-01-16 14:44:10 +01:00
|
|
|
height: isOnMon ? Settings.config.barHeight - Settings.config.barHeight / 2 : 0
|
2026-02-12 00:24:00 +01:00
|
|
|
color: modelData.focused ? Colors.primary : Colors.surfaceContainer
|
2026-02-09 20:34:31 +01:00
|
|
|
Behavior on width {
|
|
|
|
|
NumberAnimation {
|
|
|
|
|
|
2026-02-09 22:54:58 +01:00
|
|
|
duration: 500
|
|
|
|
|
easing.type: Easing.InOutBack
|
2026-02-09 20:34:31 +01:00
|
|
|
}
|
|
|
|
|
}
|
2026-01-15 01:13:17 +01:00
|
|
|
|
|
|
|
|
CustomText {
|
|
|
|
|
anchors.centerIn: workspaceNumber
|
2026-02-12 00:43:30 +01:00
|
|
|
verticalAlignment: Text.AlignVCenter
|
|
|
|
|
horizontalAlignment: Text.AlignHCenter
|
2026-01-15 01:13:17 +01:00
|
|
|
text: parent.modelData.id
|
2026-02-09 22:54:58 +01:00
|
|
|
color: parent.modelData.focused ? Colors.onPrimaryColor : Colors.onSurfaceColor
|
2026-01-26 18:20:36 +01:00
|
|
|
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();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|