mirror of
https://github.com/noctalia-dev/noctalia-shell.git
synced 2026-05-11 17:08:27 +08:00
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:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user