diff options
| author | Ivan Molodetskikh <yalterz@gmail.com> | 2024-01-16 20:28:46 +0400 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2024-01-16 20:29:37 +0400 |
| commit | 4656332d0781515f601e3a81690dfc1ee5bcc5c3 (patch) | |
| tree | 1872fd2cf47a8bba0c6a73e9e4138b8327e75266 | |
| parent | 954f711bf3b4406f260639be29b737749c9dc381 (diff) | |
| download | niri-4656332d0781515f601e3a81690dfc1ee5bcc5c3.tar.gz niri-4656332d0781515f601e3a81690dfc1ee5bcc5c3.tar.bz2 niri-4656332d0781515f601e3a81690dfc1ee5bcc5c3.zip | |
Add live-reload to libinput settings
| -rw-r--r-- | README.md | 4 | ||||
| -rw-r--r-- | src/input.rs | 2 | ||||
| -rw-r--r-- | src/niri.rs | 19 |
3 files changed, 20 insertions, 5 deletions
@@ -163,9 +163,7 @@ Niri will load configuration from `$XDG_CONFIG_HOME/.config/niri/config.kdl` or If this fails, it will load [the default configuration file](resources/default-config.kdl). Please use the default configuration file as the starting point for your custom configuration. -Niri will live-reload many of the configuration settings, like key binds or gaps, as you change the config file. -Though, some settings are still missing live-reload support. -Notably, input device libinput settings will only apply when the input device is reconnected. +Niri will live-reload most of the configuration settings, like key binds or gaps or output modes, as you change the config file. [PaperWM]: https://github.com/paperwm/PaperWM [mako]: https://github.com/emersion/mako diff --git a/src/input.rs b/src/input.rs index 0eb90c76..293bda93 100644 --- a/src/input.rs +++ b/src/input.rs @@ -89,6 +89,7 @@ impl State { match event { InputEvent::DeviceAdded { device } => { + self.niri.devices.insert(device.clone()); if device.has_capability(input::DeviceCapability::TabletTool) { match device.size() { @@ -107,6 +108,7 @@ impl State { } InputEvent::DeviceRemoved { device } => { self.niri.tablets.remove(device); + self.niri.devices.remove(device); } _ => (), } diff --git a/src/niri.rs b/src/niri.rs index 2a4cc089..4bd99e25 100644 --- a/src/niri.rs +++ b/src/niri.rs @@ -96,7 +96,7 @@ use crate::dbus::gnome_shell_screenshot::{NiriToScreenshot, ScreenshotToNiri}; use crate::dbus::mutter_screen_cast::{self, ScreenCastToNiri}; use crate::frame_clock::FrameClock; use crate::handlers::configure_lock_surface; -use crate::input::TabletData; +use crate::input::{apply_libinput_settings, TabletData}; use crate::layout::{Layout, MonitorRenderElement}; use crate::pw_utils::{Cast, PipeWire}; use crate::render_helpers::{NiriRenderer, PrimaryGpuTextureRenderElement}; @@ -135,6 +135,7 @@ pub struct Niri { // When false, we're idling with monitors powered off. pub monitors_active: bool, + pub devices: HashSet<input::Device>, pub tablets: HashMap<input::Device, TabletData>, // Smithay state. @@ -542,6 +543,7 @@ impl State { animation::ANIMATION_SLOWDOWN.store(config.debug.animation_slowdown, Ordering::Relaxed); let mut reload_xkb = None; + let mut libinput_config_changed = false; let mut output_config_changed = false; let mut old_config = self.niri.config.borrow_mut(); @@ -569,6 +571,12 @@ impl State { ); } + if config.input.touchpad != old_config.input.touchpad + || config.input.mouse != old_config.input.mouse + { + libinput_config_changed = true; + } + if config.outputs != old_config.outputs { output_config_changed = true; } @@ -586,6 +594,13 @@ impl State { } } + if libinput_config_changed { + let config = self.niri.config.borrow(); + for mut device in self.niri.devices.iter().cloned() { + apply_libinput_settings(&config.input, &mut device); + } + } + if output_config_changed { let mut resized_outputs = vec![]; for output in self.niri.global_space.outputs() { @@ -620,7 +635,6 @@ impl State { } self.niri.queue_redraw_all(); - // FIXME: apply libinput device settings. // FIXME: apply xdg decoration settings. } @@ -878,6 +892,7 @@ impl Niri { unmapped_windows: HashMap::new(), monitors_active: true, + devices: HashSet::new(), tablets: HashMap::new(), compositor_state, |
