From 597970e61b16ab42be0c4156b5d66d5b2e8d97ef Mon Sep 17 00:00:00 2001 From: lucy Date: Tue, 2 Jun 2026 23:57:12 +0200 Subject: [PATCH] fix ws.qml --- modules/bar/Mango.qml | 30 ++++++++++++++++++++++++++++++ modules/bar/Ws.qml | 31 +++++++------------------------ settings/Config.qml | 2 +- 3 files changed, 38 insertions(+), 25 deletions(-) create mode 100644 modules/bar/Mango.qml diff --git a/modules/bar/Mango.qml b/modules/bar/Mango.qml new file mode 100644 index 0000000..e9c2e32 --- /dev/null +++ b/modules/bar/Mango.qml @@ -0,0 +1,30 @@ +import Quickshell +import Quickshell.Io +import QtQuick +import qs +import qs.settings +import qs.widgets + +Item { + id: root + property string focusedTitle: "" + property int activeTag: 0 + Process { + id: getMangoTags + running: true + command: ["bash", "-c", "mmsg watch all-tags | while read line; do echo $line | jq > /tmp/mango-tags.json; done"] + } + Process { + id: getMangoTitle + running: true + command: ["bash", "-c", "mmsg watch focusing-client | while read line; do echo $line | jq > /tmp/mango-active-window.json; done"] + } + FileView { + id: activeWindowView + path: "/tmp/mango-active-window.json" + adapter: JsonAdapter { + id: activeWindowAdapter + property int id + } + } +} diff --git a/modules/bar/Ws.qml b/modules/bar/Ws.qml index 21fd1b1..e8892a9 100644 --- a/modules/bar/Ws.qml +++ b/modules/bar/Ws.qml @@ -12,13 +12,6 @@ Rectangle { id: root required property ShellScreen barScreen required property double moduleHeight - property HyprlandMonitor hyprBarScreen: Hyprland.monitorFor(root.barScreen) - - // split-monitor-workspaces numbering: each monitor owns `count` (10) - // workspaces. eDP-1 -> ids 1..10, DP-2 -> ids 11..20. The offset is the - // first id on this monitor, minus 1. - property int wsIdOffset: root.barScreen.name != Config.primaryMon ? 10 : 0 - radius: Config.rounding color: 'transparent' implicitWidth: wsLayout.implicitWidth @@ -31,24 +24,13 @@ Rectangle { spacing: 0 Repeater { id: wsRepeater - model: 10 + model: Hyprland.workspaces delegate: Rectangle { id: wsWrapper required property var modelData - - property int wsId: root.wsIdOffset + modelData + 1 - - property var ws: { - const vals = Hyprland.workspaces.values; - for (let i = 0; i < vals.length; ++i) { - if (vals[i].id === wsWrapper.wsId) - return vals[i]; - } - return null; - } - - property bool active: wsWrapper.ws ? wsWrapper.ws.active : false - property bool vacant: !wsWrapper.ws || wsWrapper.ws.toplevels.values.length === 0 + property bool active: modelData.active + property bool vacant: modelData.toplevels.values.length === 0 + visible: Hyprland.monitorFor(root.barScreen) === wsWrapper.modelData.monitor implicitHeight: root.moduleHeight implicitWidth: 16 @@ -58,9 +40,10 @@ Rectangle { StyledText { anchors.centerIn: parent - text: wsWrapper.modelData + 1 - color: wsWrapper.active ? Colors.base0D : Colors.base05 + text: wsWrapper.modelData.id > 10 ? wsWrapper.modelData.id > 20 ? wsWrapper.modelData.id - 20 : wsWrapper.modelData.id - 10 : wsWrapper.modelData.id + color: wsWrapper.active ? Colors.base0D : Colors.base04 opacity: wsWrapper.vacant ? wsWrapper.active ? 1.0 : 0.4 : 1.0 + font.bold: wsWrapper.active } MouseArea { id: clickHandler diff --git a/settings/Config.qml b/settings/Config.qml index 2dcee41..0391d07 100644 --- a/settings/Config.qml +++ b/settings/Config.qml @@ -13,7 +13,7 @@ Singleton { property url wallpaper: "file:///home/lucy/.walls/frierensuff.png" property bool floating: false property double opacity: 1.0 - property string primaryMon: "DP-2" + property string primaryMon: "eDP-1" Settings { location: Qt.resolvedUrl("file:///home/lucy/.config/quickshell/settings/settings.ini")