Add strict-new-window-focus-policy debug flag
Browse files at this commit8b84afbd38e057c6dd378bdd42b9467d8a7baa24Parent: 305fc3b3 changed files +24 -1
- niri-config/src/lib.rs +2 -0
- src/handlers/compositor.rs +8 -1
- wiki/Configuration:-Debug-Options.md +14 -0
niri-config/src/lib.rsmodified+2 -0
| @@ -1537,6 +1537,8 @@ pub struct DebugConfig { | |||
| 1537 | pub keep_laptop_panel_on_when_lid_is_closed: bool, | 1537 | pub keep_laptop_panel_on_when_lid_is_closed: bool, |
| 1538 | #[knuffel(child)] | 1538 | #[knuffel(child)] |
| 1539 | pub disable_monitor_names: bool, | 1539 | pub disable_monitor_names: bool, |
| 1540 | + #[knuffel(child)] | ||
| 1541 | + pub strict_new_window_focus_policy: bool, | ||
| 1540 | } | 1542 | } |
| 1541 | 1543 | ||
| 1542 | #[derive(knuffel::DecodeScalar, Debug, Clone, Copy, PartialEq, Eq)] | 1544 | #[derive(knuffel::DecodeScalar, Debug, Clone, Copy, PartialEq, Eq)] |
src/handlers/compositor.rsmodified+8 -1
| @@ -145,7 +145,14 @@ impl CompositorHandler for State { | |||
| 145 | .filter(|token| token.timestamp.elapsed() < XDG_ACTIVATION_TOKEN_TIMEOUT) | 145 | .filter(|token| token.timestamp.elapsed() < XDG_ACTIVATION_TOKEN_TIMEOUT) |
| 146 | { | 146 | { |
| 147 | Some(_) => ActivateWindow::Yes, | 147 | Some(_) => ActivateWindow::Yes, |
| 148 | - None => ActivateWindow::Smart, | 148 | + None => { |
| 149 | + let config = self.niri.config.borrow(); | ||
| 150 | + if config.debug.strict_new_window_focus_policy { | ||
| 151 | + ActivateWindow::No | ||
| 152 | + } else { | ||
| 153 | + ActivateWindow::Smart | ||
| 154 | + } | ||
| 155 | + } | ||
| 149 | }; | 156 | }; |
| 150 | 157 | ||
| 151 | let output = if let Some(p) = parent { | 158 | let output = if let Some(p) = parent { |
wiki/Configuration:-Debug-Options.mdmodified+14 -0
| @@ -24,6 +24,7 @@ debug { | |||
| 24 | disable-transactions | 24 | disable-transactions |
| 25 | keep-laptop-panel-on-when-lid-is-closed | 25 | keep-laptop-panel-on-when-lid-is-closed |
| 26 | disable-monitor-names | 26 | disable-monitor-names |
| 27 | + strict-new-window-focus-policy | ||
| 27 | } | 28 | } |
| 28 | 29 | ||
| 29 | binds { | 30 | binds { |
| @@ -194,6 +195,19 @@ debug { | |||
| 194 | } | 195 | } |
| 195 | ``` | 196 | ``` |
| 196 | 197 | ||
| 198 | +### `strict-new-window-focus-policy` | ||
| 199 | + | ||
| 200 | +<sup>Since: 0.1.11</sup> | ||
| 201 | + | ||
| 202 | +Disables heuristic automatic focusing for new windows. | ||
| 203 | +Only windows that activate themselves with a valid xdg-activation token will be focused. | ||
| 204 | + | ||
| 205 | +```kdl | ||
| 206 | +debug { | ||
| 207 | + strict-new-window-focus-policy | ||
| 208 | +} | ||
| 209 | +``` | ||
| 210 | + | ||
| 197 | ### Key Bindings | 211 | ### Key Bindings |
| 198 | 212 | ||
| 199 | These are not debug options, but rather key bindings. | 213 | These are not debug options, but rather key bindings. |