From f6e61ffa3bb8b153b250a90970c11e91c83ed67d Mon Sep 17 00:00:00 2001 From: Damocles Date: Sun, 12 Apr 2026 15:38:36 +0200 Subject: [PATCH 1/2] filter workspaces by monitor --- modules/Bar.qml | 2 +- modules/Workspaces.qml | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/modules/Bar.qml b/modules/Bar.qml index 48cf971..c0ee33b 100644 --- a/modules/Bar.qml +++ b/modules/Bar.qml @@ -50,7 +50,7 @@ PanelWindow { anchors.verticalCenter: parent.verticalCenter spacing: M.Theme.barSpacing - M.Workspaces { visible: M.Modules.workspaces } + M.Workspaces { bar: bar; visible: M.Modules.workspaces } M.Tray { bar: bar visible: M.Modules.tray diff --git a/modules/Workspaces.qml b/modules/Workspaces.qml index 6f45225..e185d6f 100644 --- a/modules/Workspaces.qml +++ b/modules/Workspaces.qml @@ -1,4 +1,5 @@ import QtQuick +import Quickshell import Quickshell.Io import "." as M @@ -6,8 +7,12 @@ Row { id: root spacing: 4 - property var _workspaces: [] + required property var bar + + property var _allWorkspaces: [] property int _activeId: -1 + readonly property string _output: bar.screen?.name ?? "" + readonly property var _workspaces: _allWorkspaces.filter(w => w.output === root._output) // Initial state Process { @@ -18,7 +23,7 @@ Row { onStreamFinished: { try { 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) { if (w.is_focused) root._activeId = w.id; @@ -39,7 +44,7 @@ Row { try { const ev = JSON.parse(line); if (ev.WorkspacesChanged !== undefined) { - root._workspaces = ev.WorkspacesChanged.workspaces + root._allWorkspaces = ev.WorkspacesChanged.workspaces .sort((a, b) => a.idx - b.idx); } else if (ev.WorkspaceActivated !== undefined) { if (ev.WorkspaceActivated.focused) From a1a8d0cf24b9ef8c5d5fb16d1a83f45b92b76ab1 Mon Sep 17 00:00:00 2001 From: Damocles Date: Sun, 12 Apr 2026 15:41:03 +0200 Subject: [PATCH 2/2] current app icon --- modules/WindowTitle.qml | 33 +++++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/modules/WindowTitle.qml b/modules/WindowTitle.qml index d4e7dca..8f56968 100644 --- a/modules/WindowTitle.qml +++ b/modules/WindowTitle.qml @@ -1,17 +1,23 @@ import QtQuick +import QtQuick.Effects +import Quickshell import Quickshell.Io +import Quickshell.Widgets import "." as M -M.BarLabel { +M.BarSection { id: root + spacing: M.Theme.moduleSpacing - label: root._title - color: M.Theme.base05 tooltip: root._appId ? root._appId + "\n" + root._title : root._title - elide: Text.ElideRight property string _title: "" property string _appId: "" + readonly property string _iconSource: { + if (!root._appId) return ""; + const entry = DesktopEntries.heuristicLookup(root._appId); + return entry ? Quickshell.iconPath(entry.icon) : ""; + } // Initial state — niri event-stream doesn't replay current focus Process { @@ -56,4 +62,23 @@ M.BarLabel { } } } + + IconImage { + visible: root._iconSource !== "" + source: root._iconSource + implicitSize: M.Theme.fontSize + 2 + anchors.verticalCenter: parent.verticalCenter + layer.enabled: true + layer.effect: MultiEffect { + colorization: 1.0 + colorizationColor: M.Theme.base05 + } + } + + M.BarLabel { + label: root._title + color: M.Theme.base05 + elide: Text.ElideRight + anchors.verticalCenter: parent.verticalCenter + } }