filter workspaces by monitor

This commit is contained in:
Damocles 2026-04-12 15:38:36 +02:00
parent 50cbbf6665
commit f6e61ffa3b
2 changed files with 9 additions and 4 deletions

View file

@ -50,7 +50,7 @@ PanelWindow {
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
spacing: M.Theme.barSpacing spacing: M.Theme.barSpacing
M.Workspaces { visible: M.Modules.workspaces } M.Workspaces { bar: bar; visible: M.Modules.workspaces }
M.Tray { M.Tray {
bar: bar bar: bar
visible: M.Modules.tray visible: M.Modules.tray

View file

@ -1,4 +1,5 @@
import QtQuick import QtQuick
import Quickshell
import Quickshell.Io import Quickshell.Io
import "." as M import "." as M
@ -6,8 +7,12 @@ Row {
id: root id: root
spacing: 4 spacing: 4
property var _workspaces: [] required property var bar
property var _allWorkspaces: []
property int _activeId: -1 property int _activeId: -1
readonly property string _output: bar.screen?.name ?? ""
readonly property var _workspaces: _allWorkspaces.filter(w => w.output === root._output)
// Initial state // Initial state
Process { Process {
@ -18,7 +23,7 @@ Row {
onStreamFinished: { onStreamFinished: {
try { try {
const ws = JSON.parse(text); const ws = JSON.parse(text);
root._workspaces = ws.sort((a, b) => a.idx - b.idx); root._allWorkspaces = ws.sort((a, b) => a.idx - b.idx);
for (const w of ws) { for (const w of ws) {
if (w.is_focused) if (w.is_focused)
root._activeId = w.id; root._activeId = w.id;
@ -39,7 +44,7 @@ Row {
try { try {
const ev = JSON.parse(line); const ev = JSON.parse(line);
if (ev.WorkspacesChanged !== undefined) { if (ev.WorkspacesChanged !== undefined) {
root._workspaces = ev.WorkspacesChanged.workspaces root._allWorkspaces = ev.WorkspacesChanged.workspaces
.sort((a, b) => a.idx - b.idx); .sort((a, b) => a.idx - b.idx);
} else if (ev.WorkspaceActivated !== undefined) { } else if (ev.WorkspaceActivated !== undefined) {
if (ev.WorkspaceActivated.focused) if (ev.WorkspaceActivated.focused)