lock: make window hiding anim work with floating windows

This commit is contained in:
end-4
2025-10-30 11:07:57 +01:00
parent b484e3311c
commit dfbbe3fcca
@@ -1,4 +1,6 @@
pragma ComponentBehavior: Bound
import qs import qs
import qs.services
import qs.modules.common import qs.modules.common
import qs.modules.common.functions import qs.modules.common.functions
import qs.modules.lock import qs.modules.lock
@@ -20,6 +22,20 @@ Scope {
}) })
} }
property var windowData: []
function saveWindowPositionAndTile() {
root.windowData = HyprlandData.windowList.filter(w => w.floating)
root.windowData.forEach(w => {
Hyprland.dispatch(`settiled address:${w.address}`)
})
}
function restoreWindowPositionAndTile() {
root.windowData.forEach(w => {
Hyprland.dispatch(`setfloating address:${w.address}`)
Hyprland.dispatch(`movewindowpixel exact ${w.at[0]} ${w.at[1]}, address:${w.address}`)
})
}
// This stores all the information shared between the lock surfaces on each screen. // This stores all the information shared between the lock surfaces on each screen.
// https://github.com/quickshell-mirror/quickshell-examples/tree/master/lockscreen // https://github.com/quickshell-mirror/quickshell-examples/tree/master/lockscreen
LockContext { LockContext {
@@ -91,9 +107,11 @@ Scope {
property int horizontalSqueeze: modelData.width * 0.2 property int horizontalSqueeze: modelData.width * 0.2
onShouldPushChanged: { onShouldPushChanged: {
if (shouldPush) { if (shouldPush) {
root.saveWindowPositionAndTile();
Quickshell.execDetached(["bash", "-c", `hyprctl keyword monitor ${targetMonitorName}, addreserved, ${verticalMovementDistance}, ${-verticalMovementDistance}, ${horizontalSqueeze}, ${horizontalSqueeze}`]) Quickshell.execDetached(["bash", "-c", `hyprctl keyword monitor ${targetMonitorName}, addreserved, ${verticalMovementDistance}, ${-verticalMovementDistance}, ${horizontalSqueeze}, ${horizontalSqueeze}`])
} else { } else {
Quickshell.execDetached(["bash", "-c", `hyprctl keyword monitor ${targetMonitorName}, addreserved, 0, 0, 0, 0`]) Quickshell.execDetached(["bash", "-c", `hyprctl keyword monitor ${targetMonitorName}, addreserved, 0, 0, 0, 0`])
root.restoreWindowPositionAndTile();
} }
} }
} }