picker: fix clients for special ws
Also focus on first window if none focused on init
This commit is contained in:
parent
a14430e759
commit
7157fe2cdd
2 changed files with 27 additions and 14 deletions
|
|
@ -1,5 +1,3 @@
|
||||||
import qs.utils
|
|
||||||
import qs.config
|
|
||||||
import Quickshell
|
import Quickshell
|
||||||
import Quickshell.Wayland
|
import Quickshell.Wayland
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -36,14 +36,17 @@ MouseArea {
|
||||||
property real sw: Math.abs(sx - ex)
|
property real sw: Math.abs(sx - ex)
|
||||||
property real sh: Math.abs(sy - ey)
|
property real sh: Math.abs(sy - ey)
|
||||||
|
|
||||||
property list<var> clients: Hyprland.toplevels.values.filter(c => c.workspace?.id === Hyprland.activeWsId).sort((a, b) => {
|
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
|
// Pinned first, then floating, then any other
|
||||||
if (a.lastIpcObject.pinned === b.lastIpcObject.pinned)
|
if (a.lastIpcObject.pinned === b.lastIpcObject.pinned)
|
||||||
return a.lastIpcObject.floating === b.lastIpcObject.floating ? 0 : a.lastIpcObject.floating ? -1 : 1;
|
return a.lastIpcObject.floating === b.lastIpcObject.floating ? 0 : a.lastIpcObject.floating ? -1 : 1;
|
||||||
if (a.lastIpcObject.pinned)
|
if (a.lastIpcObject.pinned)
|
||||||
return -1;
|
return -1;
|
||||||
return 1;
|
return 1;
|
||||||
})
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function checkClientRects(x: real, y: real): void {
|
function checkClientRects(x: real, y: real): void {
|
||||||
for (const client of clients) {
|
for (const client of clients) {
|
||||||
|
|
@ -75,11 +78,23 @@ MouseArea {
|
||||||
clients = clients;
|
clients = clients;
|
||||||
|
|
||||||
opacity = 1;
|
opacity = 1;
|
||||||
|
|
||||||
|
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;
|
sx = screen.width / 2 - 100;
|
||||||
sy = screen.height / 2 - 100;
|
sy = screen.height / 2 - 100;
|
||||||
ex = screen.width / 2 + 100;
|
ex = screen.width / 2 + 100;
|
||||||
ey = screen.height / 2 + 100;
|
ey = screen.height / 2 + 100;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
onPressed: event => {
|
onPressed: event => {
|
||||||
ssx = event.x;
|
ssx = event.x;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue