Add live-reload of output positions
Browse files at this commit83719a49b7ddf8f6b5c7fa348ed9fc3a386eab23Parent: da4967d2 changed files +10 -1
- README.md +1 -1
- src/niri.rs +9 -0
README.mdmodified+1 -1
| @@ -165,7 +165,7 @@ Please use the default configuration file as the starting point for your custom | |||
| 165 | 165 | ||
| 166 | Niri will live-reload many of the configuration settings, like key binds or gaps, as you change the config file. | 166 | Niri will live-reload many of the configuration settings, like key binds or gaps, as you change the config file. |
| 167 | Though, some settings are still missing live-reload support. | 167 | Though, some settings are still missing live-reload support. |
| 168 | -Notably, output modes and positions will only apply when the output is reconnected. | 168 | +Notably, output modes will only apply when the output is reconnected. |
| 169 | 169 | ||
| 170 | [PaperWM]: https://github.com/paperwm/PaperWM | 170 | [PaperWM]: https://github.com/paperwm/PaperWM |
| 171 | [mako]: https://github.com/emersion/mako | 171 | [mako]: https://github.com/emersion/mako |
src/niri.rsmodified+9 -0
| @@ -542,6 +542,7 @@ impl State { | |||
| 542 | animation::ANIMATION_SLOWDOWN.store(config.debug.animation_slowdown, Ordering::Relaxed); | 542 | animation::ANIMATION_SLOWDOWN.store(config.debug.animation_slowdown, Ordering::Relaxed); |
| 543 | 543 | ||
| 544 | let mut reload_xkb = None; | 544 | let mut reload_xkb = None; |
| 545 | + let mut output_config_changed = false; | ||
| 545 | let mut old_config = self.niri.config.borrow_mut(); | 546 | let mut old_config = self.niri.config.borrow_mut(); |
| 546 | 547 | ||
| 547 | // Reload the cursor. | 548 | // Reload the cursor. |
| @@ -568,6 +569,10 @@ impl State { | |||
| 568 | ); | 569 | ); |
| 569 | } | 570 | } |
| 570 | 571 | ||
| 572 | + if config.outputs != old_config.outputs { | ||
| 573 | + output_config_changed = true; | ||
| 574 | + } | ||
| 575 | + | ||
| 571 | *old_config = config; | 576 | *old_config = config; |
| 572 | 577 | ||
| 573 | // Release the borrow. | 578 | // Release the borrow. |
| @@ -581,6 +586,10 @@ impl State { | |||
| 581 | } | 586 | } |
| 582 | } | 587 | } |
| 583 | 588 | ||
| 589 | + if output_config_changed { | ||
| 590 | + self.niri.reposition_outputs(None); | ||
| 591 | + } | ||
| 592 | + | ||
| 584 | self.niri.queue_redraw_all(); | 593 | self.niri.queue_redraw_all(); |
| 585 | // FIXME: apply output scale and whatnot. | 594 | // FIXME: apply output scale and whatnot. |
| 586 | // FIXME: apply libinput device settings. | 595 | // FIXME: apply libinput device settings. |