fix(compositor): add z-order handling for focus in hyprland

- Add null checks for window objects before focusing to prevent errors.
- Also ensure focused windows are brought to top in Float Mode by
dispatching alterzorder command after focuswindow.
This commit is contained in:
Ahmet Çetinkaya
2025-12-04 18:02:40 +03:00
parent cf5fed24b2
commit 99582bb8fe
+12 -1
View File
@@ -436,7 +436,18 @@ Item {
function focusWindow(window) {
try {
Hyprland.dispatch(`focuswindow address:0x${window.id.toString()}`);
if (!window || !window.id) {
Logger.w("HyprlandService", "Invalid window object for focus");
return;
}
const windowId = window.id.toString();
// Focus the window
Hyprland.dispatch(`focuswindow address:0x${windowId}`);
// Bring the focused window to the top (essential for Float Mode)
Hyprland.dispatch(`alterzorder top,address:0x${windowId}`);
} catch (e) {
Logger.e("HyprlandService", "Failed to switch window:", e);
}