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

@ -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