diff options
| author | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-08-16 16:07:13 +1000 |
|---|---|---|
| committer | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-08-16 16:07:13 +1000 |
| commit | 00b5e88a3268dce07429786419f34105d68e3d8d (patch) | |
| tree | 91069d24c9ae1b27060f935eb0ff438e1445e374 | |
| parent | bar/workspaces: add special ws overlay (diff) | |
| download | caelestia-shell-00b5e88a3268dce07429786419f34105d68e3d8d.tar.gz caelestia-shell-00b5e88a3268dce07429786419f34105d68e3d8d.tar.bz2 caelestia-shell-00b5e88a3268dce07429786419f34105d68e3d8d.zip | |
bar/workspaces: better scroll
| -rw-r--r-- | modules/bar/Bar.qml | 9 | ||||
| -rw-r--r-- | modules/bar/components/workspaces/SpecialWorkspaces.qml | 9 |
2 files changed, 13 insertions, 5 deletions
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 { |