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/config.rs | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'src/config.rs') diff --git a/src/config.rs b/src/config.rs index a261c64c..0005789a 100644 --- a/src/config.rs +++ b/src/config.rs @@ -21,6 +21,8 @@ pub struct Config { #[knuffel(child, default)] pub prefer_no_csd: bool, #[knuffel(child, default)] + pub cursor: Cursor, + #[knuffel(child, default)] pub binds: Binds, #[knuffel(child, default)] pub debug: DebugConfig, @@ -152,6 +154,23 @@ impl From for [f32; 4] { } } +#[derive(knuffel::Decode, Debug, PartialEq)] +pub struct Cursor { + #[knuffel(child, unwrap(argument), default = String::from("default"))] + pub xcursor_theme: String, + #[knuffel(child, unwrap(argument), default = 24)] + pub xcursor_size: u8, +} + +impl Default for Cursor { + fn default() -> Self { + Self { + xcursor_theme: String::from("default"), + xcursor_size: 24, + } + } +} + #[derive(knuffel::Decode, Debug, Default, PartialEq, Eq)] pub struct Binds(#[knuffel(children)] pub Vec); @@ -366,6 +385,11 @@ mod tests { prefer-no-csd + cursor { + xcursor-theme "breeze_cursors" + xcursor-size 16 + } + binds { Mod+T { spawn "alacritty"; } Mod+Q { close-window; } @@ -421,6 +445,10 @@ mod tests { }, }, prefer_no_csd: true, + cursor: Cursor { + xcursor_theme: String::from("breeze_cursors"), + xcursor_size: 16, + }, binds: Binds(vec![ Bind { key: Key { -- cgit