Add is_floating to Window IPC

This commit is contained in:
Ivan Molodetskikh
2024-12-28 10:28:52 +03:00
parent 5b4750a009
commit 60854e180e
3 changed files with 12 additions and 1 deletions
+4
View File
@@ -758,6 +758,10 @@ pub struct Window {
///
/// There can be either one focused window or zero (e.g. when a layer-shell surface has focus).
pub is_focused: bool,
/// Whether this window is currently floating.
///
/// If the window isn't floating then it is in the tiling layout.
pub is_floating: bool,
}
/// Output configuration change result.
+5
View File
@@ -516,6 +516,11 @@ fn print_window(window: &Window) {
println!(" App ID: (unset)");
}
println!(
" Is floating: {}",
if window.is_floating { "yes" } else { "no" }
);
if let Some(pid) = window.pid {
println!(" PID: {pid}");
} else {
+3 -1
View File
@@ -412,6 +412,7 @@ fn make_ipc_window(mapped: &Mapped, workspace_id: Option<WorkspaceId>) -> niri_i
pid: mapped.credentials().map(|c| c.pid),
workspace_id: workspace_id.map(|id| id.get()),
is_focused: mapped.is_focused(),
is_floating: mapped.is_floating(),
})
}
@@ -592,7 +593,8 @@ impl State {
};
let workspace_id = ws_id.map(|id| id.get());
let mut changed = ipc_win.workspace_id != workspace_id;
let mut changed =
ipc_win.workspace_id != workspace_id || ipc_win.is_floating != mapped.is_floating();
changed |= with_toplevel_role(mapped.toplevel(), |role| {
ipc_win.title != role.title || ipc_win.app_id != role.app_id