bar/workspaces: filter by monitor, switch to scriptmodel

This commit is contained in:
kossLAN 2025-06-10 21:48:17 -04:00
parent 9aa51c86da
commit c2a80e1044
Signed by: kossLAN
SSH key fingerprint: SHA256:bdV0x+wdQHGJ6LgmstH3KV8OpWY+OOFmJcPcB0wQPV8
2 changed files with 14 additions and 11 deletions

View file

@ -39,6 +39,7 @@ PanelWindow {
}
HyprWorkspaces {
screen: root.screen
Layout.fillWidth: false
Layout.preferredHeight: parent.height
Layout.margins: 4
@ -98,7 +99,9 @@ PanelWindow {
// screen: root
// }
Widgets.Separator {}
Widgets.Separator {
Layout.leftMargin: 10
}
Clock {
id: clock

View file

@ -1,23 +1,23 @@
import QtQuick
import QtQuick.Layouts
import Quickshell
import Quickshell.Hyprland
import ".."
RowLayout {
property var sortedWorkspaces: {
let values = Hyprland.workspaces.values.slice();
values.sort(function (a, b) {
return a.id - b.id;
});
return values;
}
spacing: 6
visible: Hyprland.monitors.values.length != 0
required property var screen
Repeater {
model: parent.sortedWorkspaces
model: ScriptModel {
values: Hyprland.workspaces.values.slice().filter(
workspace => workspace.monitor === Hyprland.monitorFor(screen)
).sort((a,b) => {
return a.id - b.id;
});
}
Rectangle {
required property var modelData