diff options
| author | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-08-09 17:18:51 +1000 |
|---|---|---|
| committer | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-08-09 17:18:51 +1000 |
| commit | 7157fe2cddc3583a0219e59251d273e86c423569 (patch) | |
| tree | a1b780c8591c84d8e35df7b3f72d16234507ca5a | |
| parent | nix: make package derivation patchable (#378) (diff) | |
| download | caelestia-shell-7157fe2cddc3583a0219e59251d273e86c423569.tar.gz caelestia-shell-7157fe2cddc3583a0219e59251d273e86c423569.tar.bz2 caelestia-shell-7157fe2cddc3583a0219e59251d273e86c423569.zip | |
picker: fix clients for special ws
Also focus on first window if none focused on init
| -rw-r--r-- | components/containers/StyledWindow.qml | 2 | ||||
| -rw-r--r-- | modules/areapicker/Picker.qml | 39 |
2 files changed, 27 insertions, 14 deletions
diff --git a/components/containers/StyledWindow.qml b/components/containers/StyledWindow.qml index 3b402b5..8c6e39f 100644 --- a/components/containers/StyledWindow.qml +++ b/components/containers/StyledWindow.qml @@ -1,5 +1,3 @@ -import qs.utils -import qs.config import Quickshell import Quickshell.Wayland diff --git a/modules/areapicker/Picker.qml b/modules/areapicker/Picker.qml index 4c574ad..afb1017 100644 --- a/modules/areapicker/Picker.qml +++ b/modules/areapicker/Picker.qml @@ -36,14 +36,17 @@ MouseArea { property real sw: Math.abs(sx - ex) property real sh: Math.abs(sy - ey) - property list<var> clients: Hyprland.toplevels.values.filter(c => c.workspace?.id === Hyprland.activeWsId).sort((a, b) => { - // Pinned first, then floating, then any other - if (a.lastIpcObject.pinned === b.lastIpcObject.pinned) - return a.lastIpcObject.floating === b.lastIpcObject.floating ? 0 : a.lastIpcObject.floating ? -1 : 1; - if (a.lastIpcObject.pinned) - return -1; - return 1; - }) + property list<var> clients: { + const ws = Hyprland.activeToplevel?.workspace?.id ?? Hyprland.activeWsId; + return Hyprland.toplevels.values.filter(c => c.workspace?.id === ws).sort((a, b) => { + // Pinned first, then floating, then any other + if (a.lastIpcObject.pinned === b.lastIpcObject.pinned) + return a.lastIpcObject.floating === b.lastIpcObject.floating ? 0 : a.lastIpcObject.floating ? -1 : 1; + if (a.lastIpcObject.pinned) + return -1; + return 1; + }); + } function checkClientRects(x: real, y: real): void { for (const client of clients) { @@ -75,10 +78,22 @@ MouseArea { clients = clients; opacity = 1; - sx = screen.width / 2 - 100; - sy = screen.height / 2 - 100; - ex = screen.width / 2 + 100; - ey = screen.height / 2 + 100; + + const c = clients[0]; + if (c) { + const cx = c.lastIpcObject.at[0] - screen.x; + const cy = c.lastIpcObject.at[1] - screen.y; + onClient = true; + sx = cx; + sy = cy; + ex = cx + c.lastIpcObject.size[0]; + ey = cy + c.lastIpcObject.size[1]; + } else { + sx = screen.width / 2 - 100; + sy = screen.height / 2 - 100; + ex = screen.width / 2 + 100; + ey = screen.height / 2 + 100; + } } onPressed: event => { |