@@ -2274,6 +2274,14 @@ impl WindowManager { |
| 2274 | Ok(()) | 2274 | Ok(()) |
| 2275 | } | 2275 | } |
| 2276 | | 2276 | |
| | 2277 | + /// Force refresh layout - just re-apply layout. |
| | 2278 | + /// Note: GTK apps may not fully re-render at new scale without restart. |
| | 2279 | + fn force_refresh_layout(&mut self) -> Result<()> { |
| | 2280 | + self.apply_layout()?; |
| | 2281 | + tracing::info!("Layout refreshed"); |
| | 2282 | + Ok(()) |
| | 2283 | + } |
| | 2284 | + |
| 2277 | /// Execute an i3-compatible command (from IPC RUN_COMMAND). | 2285 | /// Execute an i3-compatible command (from IPC RUN_COMMAND). |
| 2278 | /// Returns true if the command was executed successfully. | 2286 | /// Returns true if the command was executed successfully. |
| 2279 | fn execute_i3_command(&mut self, cmd: &str) -> bool { | 2287 | fn execute_i3_command(&mut self, cmd: &str) -> bool { |
@@ -2832,6 +2840,18 @@ impl WindowManager { |
| 2832 | Err(e) => Response::error(e.to_string()), | 2840 | Err(e) => Response::error(e.to_string()), |
| 2833 | } | 2841 | } |
| 2834 | } | 2842 | } |
| | 2843 | + "refresh_layout" => { |
| | 2844 | + // Re-apply layout to all windows without changing ratios. |
| | 2845 | + // Useful after display scaling changes when GTK apps resize internally. |
| | 2846 | + // Two-step approach: first shrink windows, then expand - forces GTK to re-layout. |
| | 2847 | + match self.force_refresh_layout() { |
| | 2848 | + Ok(_) => { |
| | 2849 | + tracing::info!("Layout force-refreshed"); |
| | 2850 | + Response::success(None) |
| | 2851 | + } |
| | 2852 | + Err(e) => Response::error(e.to_string()), |
| | 2853 | + } |
| | 2854 | + } |
| 2835 | "reload" => { | 2855 | "reload" => { |
| 2836 | match self.reload_config() { | 2856 | match self.reload_config() { |
| 2837 | Ok(_) => Response::success(None), | 2857 | Ok(_) => Response::success(None), |