Add is_floating to Window IPC
Browse files at this commit60854e180e692de3ec4acd505936e34a8640f1f6Parent: 5b4750a3 changed files +12 -1
- niri-ipc/src/lib.rs +4 -0
- src/ipc/client.rs +5 -0
- src/ipc/server.rs +3 -1
niri-ipc/src/lib.rsmodified+4 -0
| @@ -758,6 +758,10 @@ pub struct Window { | |||
| 758 | /// | 758 | /// |
| 759 | /// There can be either one focused window or zero (e.g. when a layer-shell surface has focus). | 759 | /// There can be either one focused window or zero (e.g. when a layer-shell surface has focus). |
| 760 | pub is_focused: bool, | 760 | 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, | ||
| 761 | } | 765 | } |
| 762 | 766 | ||
| 763 | /// Output configuration change result. | 767 | /// Output configuration change result. |
src/ipc/client.rsmodified+5 -0
| @@ -516,6 +516,11 @@ fn print_window(window: &Window) { | |||
| 516 | println!(" App ID: (unset)"); | 516 | println!(" App ID: (unset)"); |
| 517 | } | 517 | } |
| 518 | 518 | ||
| 519 | + println!( | ||
| 520 | + " Is floating: {}", | ||
| 521 | + if window.is_floating { "yes" } else { "no" } | ||
| 522 | + ); | ||
| 523 | + | ||
| 519 | if let Some(pid) = window.pid { | 524 | if let Some(pid) = window.pid { |
| 520 | println!(" PID: {pid}"); | 525 | println!(" PID: {pid}"); |
| 521 | } else { | 526 | } else { |
src/ipc/server.rsmodified+3 -1
| @@ -412,6 +412,7 @@ fn make_ipc_window(mapped: &Mapped, workspace_id: Option<WorkspaceId>) -> niri_i | |||
| 412 | pid: mapped.credentials().map(|c| c.pid), | 412 | pid: mapped.credentials().map(|c| c.pid), |
| 413 | workspace_id: workspace_id.map(|id| id.get()), | 413 | workspace_id: workspace_id.map(|id| id.get()), |
| 414 | is_focused: mapped.is_focused(), | 414 | is_focused: mapped.is_focused(), |
| 415 | + is_floating: mapped.is_floating(), | ||
| 415 | }) | 416 | }) |
| 416 | } | 417 | } |
| 417 | 418 | ||
| @@ -592,7 +593,8 @@ impl State { | |||
| 592 | }; | 593 | }; |
| 593 | 594 | ||
| 594 | let workspace_id = ws_id.map(|id| id.get()); | 595 | 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(); | ||
| 596 | 598 | ||
| 597 | changed |= with_toplevel_role(mapped.toplevel(), |role| { | 599 | changed |= with_toplevel_role(mapped.toplevel(), |role| { |
| 598 | ipc_win.title != role.title || ipc_win.app_id != role.app_id | 600 | ipc_win.title != role.title || ipc_win.app_id != role.app_id |