picker: better client detection
This commit is contained in:
parent
6200f400f3
commit
93a779ffbd
1 changed files with 13 additions and 10 deletions
|
|
@ -38,8 +38,14 @@ MouseArea {
|
|||
property real sh: Math.abs(sy - ey)
|
||||
|
||||
property list<var> clients: {
|
||||
const ws = Hypr.activeToplevel?.workspace?.id ?? Hypr.activeWsId;
|
||||
return Hypr.toplevels.values.filter(c => c.workspace?.id === ws).sort((a, b) => {
|
||||
const mon = Hypr.monitorFor(screen);
|
||||
if (!mon)
|
||||
return [];
|
||||
|
||||
const special = mon.lastIpcObject.specialWorkspace;
|
||||
const wsId = special.name ? special.id : mon.activeWorkspace.id;
|
||||
|
||||
return Hypr.toplevels.values.filter(c => c.workspace?.id === wsId).sort((a, b) => {
|
||||
// Pinned first, then fullscreen, then floating, then any other
|
||||
const ac = a.lastIpcObject;
|
||||
const bc = b.lastIpcObject;
|
||||
|
|
@ -49,6 +55,9 @@ MouseArea {
|
|||
|
||||
function checkClientRects(x: real, y: real): void {
|
||||
for (const client of clients) {
|
||||
if (!client)
|
||||
continue;
|
||||
|
||||
let {
|
||||
at: [cx, cy],
|
||||
size: [cw, ch]
|
||||
|
|
@ -72,6 +81,8 @@ MouseArea {
|
|||
closeAnim.start();
|
||||
}
|
||||
|
||||
onClientsChanged: checkClientRects(mouseX, mouseY)
|
||||
|
||||
anchors.fill: parent
|
||||
opacity: 0
|
||||
hoverEnabled: true
|
||||
|
|
@ -175,14 +186,6 @@ MouseArea {
|
|||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: Hypr
|
||||
|
||||
function onActiveWsIdChanged(): void {
|
||||
root.checkClientRects(root.mouseX, root.mouseY);
|
||||
}
|
||||
}
|
||||
|
||||
Process {
|
||||
running: true
|
||||
command: ["hyprctl", "-j", "getoption", "general:border_size"]
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue