From 00b5e88a3268dce07429786419f34105d68e3d8d Mon Sep 17 00:00:00 2001 From: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> Date: Sat, 16 Aug 2025 16:07:13 +1000 Subject: bar/workspaces: better scroll --- modules/bar/Bar.qml | 9 +++++---- modules/bar/components/workspaces/SpecialWorkspaces.qml | 9 ++++++++- 2 files changed, 13 insertions(+), 5 deletions(-) (limited to 'modules') diff --git a/modules/bar/Bar.qml b/modules/bar/Bar.qml index 58a30d1..09cebee 100644 --- a/modules/bar/Bar.qml +++ b/modules/bar/Bar.qml @@ -56,10 +56,11 @@ ColumnLayout { const ch = childAt(width / 2, y) as WrappedLoader; if (ch?.id === "workspaces") { // Workspace scroll - const activeWs = Hyprland.activeToplevel?.workspace?.name; - if (activeWs?.startsWith("special:")) - Hyprland.dispatch(`togglespecialworkspace ${activeWs.slice(8)}`); - else if (angleDelta.y < 0 || Hyprland.activeWsId > 1) + const mon = (Config.bar.workspaces.perMonitorWorkspaces ? Hyprland.monitorFor(screen) : Hyprland.focusedMonitor); + const specialWs = mon?.lastIpcObject.specialWorkspace.name; + if (specialWs?.length > 0) + Hyprland.dispatch(`togglespecialworkspace ${specialWs.slice(8)}`); + else if (angleDelta.y < 0 || (Config.bar.workspaces.perMonitorWorkspaces ? mon.activeWorkspace?.id : Hyprland.activeWsId) > 1) Hyprland.dispatch(`workspace r${angleDelta.y > 0 ? "-" : "+"}1`); } else if (y < screen.height / 2) { // Volume scroll on top half diff --git a/modules/bar/components/workspaces/SpecialWorkspaces.qml b/modules/bar/components/workspaces/SpecialWorkspaces.qml index 7ed4515..fb31257 100644 --- a/modules/bar/components/workspaces/SpecialWorkspaces.qml +++ b/modules/bar/components/workspaces/SpecialWorkspaces.qml @@ -120,6 +120,7 @@ Item { required property HyprlandWorkspace modelData readonly property int size: label.Layout.preferredHeight + (hasWindows ? windows.implicitHeight + Appearance.padding.small : 0) + property int wsId property string icon property bool hasWindows @@ -129,6 +130,7 @@ Item { spacing: 0 Component.onCompleted: { + wsId = modelData.id; icon = Icons.getSpecialWsIcon(modelData.name); hasWindows = Config.bar.workspaces.showWindows && modelData.lastIpcObject.windows > 0; } @@ -137,6 +139,11 @@ Item { Connections { target: ws.modelData + function onIdChanged(): void { + if (ws.modelData) + ws.wsId = ws.modelData.id; + } + function onNameChanged(): void { if (ws.modelData) ws.icon = Icons.getSpecialWsIcon(ws.modelData.name); @@ -222,7 +229,7 @@ Item { Repeater { model: ScriptModel { - values: Hyprland.toplevels.values.filter(c => c.workspace?.id === ws.modelData.id) + values: Hyprland.toplevels.values.filter(c => c.workspace?.id === ws.wsId) } MaterialIcon { -- cgit v1.2.3-freya