diff options
| author | Ivan Molodetskikh <yalterz@gmail.com> | 2024-12-28 10:28:52 +0300 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2024-12-30 20:12:37 +0300 |
| commit | 60854e180e692de3ec4acd505936e34a8640f1f6 (patch) | |
| tree | d184aa94d87c4bddfe3d5766b915564c7bcf4689 | |
| parent | 5b4750a009a9ce1d3c98045c18509b1157e5519b (diff) | |
| download | niri-60854e180e692de3ec4acd505936e34a8640f1f6.tar.gz niri-60854e180e692de3ec4acd505936e34a8640f1f6.tar.bz2 niri-60854e180e692de3ec4acd505936e34a8640f1f6.zip | |
Add is_floating to Window IPC
| -rw-r--r-- | niri-ipc/src/lib.rs | 4 | ||||
| -rw-r--r-- | src/ipc/client.rs | 5 | ||||
| -rw-r--r-- | src/ipc/server.rs | 4 |
3 files changed, 12 insertions, 1 deletions
diff --git a/niri-ipc/src/lib.rs b/niri-ipc/src/lib.rs index fea7543f..1d596941 100644 --- a/niri-ipc/src/lib.rs +++ b/niri-ipc/src/lib.rs @@ -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. diff --git a/src/ipc/client.rs b/src/ipc/client.rs index b2938b61..8682d8d3 100644 --- a/src/ipc/client.rs +++ b/src/ipc/client.rs @@ -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 { diff --git a/src/ipc/server.rs b/src/ipc/server.rs index facb59d3..8828ab1a 100644 --- a/src/ipc/server.rs +++ b/src/ipc/server.rs @@ -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 |
