forge
Explore
Log in

Don't you dare go Hollow

Add is_floating to Window IPC

Browse files at this commit

60854e180e692de3ec4acd505936e34a8640f1f6Ivan MolodetskikhParent: 5b4750a
niri-ipc/src/lib.rsmodified+4 -0
@@ -758,6 +758,10 @@ pub struct Window {
758758 ///
759759 /// There can be either one focused window or zero (e.g. when a layer-shell surface has focus).
760760 pub is_focused: bool,
761+ /// Whether this window is currently floating.
762+ ///
763+ /// If the window isn't floating then it is in the tiling layout.
764+ pub is_floating: bool,
761765 }
762766
763767 /// Output configuration change result.
src/ipc/client.rsmodified+5 -0
@@ -516,6 +516,11 @@ fn print_window(window: &Window) {
516516 println!(" App ID: (unset)");
517517 }
518518
519+ println!(
520+ " Is floating: {}",
521+ if window.is_floating { "yes" } else { "no" }
522+ );
523+
519524 if let Some(pid) = window.pid {
520525 println!(" PID: {pid}");
521526 } else {
src/ipc/server.rsmodified+3 -1
@@ -412,6 +412,7 @@ fn make_ipc_window(mapped: &Mapped, workspace_id: Option<WorkspaceId>) -> niri_i
412412 pid: mapped.credentials().map(|c| c.pid),
413413 workspace_id: workspace_id.map(|id| id.get()),
414414 is_focused: mapped.is_focused(),
415+ is_floating: mapped.is_floating(),
415416 })
416417 }
417418
@@ -592,7 +593,8 @@ impl State {
592593 };
593594
594595 let workspace_id = ws_id.map(|id| id.get());
595- let mut changed = ipc_win.workspace_id != workspace_id;
596+ let mut changed =
597+ ipc_win.workspace_id != workspace_id || ipc_win.is_floating != mapped.is_floating();
596598
597599 changed |= with_toplevel_role(mapped.toplevel(), |role| {
598600 ipc_win.title != role.title || ipc_win.app_id != role.app_id