From e8258d798a779d4cbd9fe93f91614db569f55db2 Mon Sep 17 00:00:00 2001 From: Zacharias-Brohn Date: Wed, 15 Oct 2025 12:07:34 +0200 Subject: [PATCH] WIP per-monitor workspaces - Hyprland --- Bar.qml | 1 + Modules/CustomTrayMenu.qml | 2 +- Modules/WindowTitle.qml | 3 ++- Modules/Workspaces.qml | 16 +++++++++++++++- 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/Bar.qml b/Bar.qml index ce0cd79..42190a5 100644 --- a/Bar.qml +++ b/Bar.qml @@ -47,6 +47,7 @@ Scope { Layout.fillHeight: true Layout.topMargin: 6 Layout.bottomMargin: 6 + screen: bar.screen } AudioWidget { diff --git a/Modules/CustomTrayMenu.qml b/Modules/CustomTrayMenu.qml index 3684a2b..7ede033 100644 --- a/Modules/CustomTrayMenu.qml +++ b/Modules/CustomTrayMenu.qml @@ -7,7 +7,7 @@ import qs.Modules PopupWindow { id: popup - color: "#FF202020" + color: "#00202020" required property QsMenuOpener trayMenu diff --git a/Modules/WindowTitle.qml b/Modules/WindowTitle.qml index 8e3ddc4..0094ccd 100644 --- a/Modules/WindowTitle.qml +++ b/Modules/WindowTitle.qml @@ -18,7 +18,8 @@ Item { running: false stdout: StdioCollector { onStreamFinished: { - root.currentTitle = this.text.trim().replace(/\"/g, "") + let cleaned = this.text.trim().replace(/\"/g, "") + root.currentTitle = ( cleaned === "null" ) ? "" : cleaned } } } diff --git a/Modules/Workspaces.qml b/Modules/Workspaces.qml index 694e154..0d094d3 100644 --- a/Modules/Workspaces.qml +++ b/Modules/Workspaces.qml @@ -6,7 +6,21 @@ import Quickshell.Hyprland Rectangle { id: root - + + required property ShellScreen screen + + readonly property int activeWsId: ( Hyprland.monitorFor( screen ).activeWorkspace?.id ?? 1 ) + + readonly property var occupied: Hyprland.workspaces.values.reduce(( acc, curr ) => { + acc[ curr.id ] = curr.lastIpcObject.windows > 0; + return acc; + }) + readonly property int groupOffset: Math.floor(( activeWsId - 1 ) / 10) * 10 + readonly property int ws: 1 + groupOffset + + readonly property bool isOccupied: occupied[ ws ] ?? false + + implicitWidth: workspacesRow.implicitWidth + 10 implicitHeight: workspacesRow.implicitHeight + 7