From d8a511bbac8d487c537dc325d105c1b07ff9c0cf Mon Sep 17 00:00:00 2001 From: Kirill Chibisov Date: Sun, 1 Oct 2023 17:42:56 +0400 Subject: config/input: add cursor section This should allow users to configure theme and size for the cursor, as well as automatically set `XCURSOR_THEME` and `XCURSOR_SIZE` env variables. --- src/niri.rs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'src/niri.rs') diff --git a/src/niri.rs b/src/niri.rs index dda9cd29..8c4579fc 100644 --- a/src/niri.rs +++ b/src/niri.rs @@ -262,7 +262,18 @@ impl State { } }; - *self.niri.config.borrow_mut() = config; + let mut old_config = self.niri.config.borrow_mut(); + + if config.cursor != old_config.cursor { + self.niri.default_cursor = + Cursor::load(&config.cursor.xcursor_theme, config.cursor.xcursor_size); + } + + *old_config = config; + + // Release the borrow. + drop(old_config); + self.niri.queue_redraw_all(); // FIXME: apply output scale and whatnot. // FIXME: apply libinput device settings. @@ -329,7 +340,8 @@ impl Niri { .unwrap(); seat.add_pointer(); - let default_cursor = Cursor::load(); + let default_cursor = + Cursor::load(&config_.cursor.xcursor_theme, config_.cursor.xcursor_size); let socket_source = ListeningSocketSource::new_auto().unwrap(); let socket_name = socket_source.socket_name().to_os_string(); -- cgit