aboutsummaryrefslogtreecommitdiff
path: root/src/config.rs
diff options
context:
space:
mode:
authorKirill Chibisov <contact@kchibisov.com>2023-10-01 17:42:56 +0400
committerIvan Molodetskikh <yalterz@gmail.com>2023-10-01 17:50:42 +0300
commitd8a511bbac8d487c537dc325d105c1b07ff9c0cf (patch)
tree562c4f77d1ab98f704a6a03f13ca5046b8ad9dd5 /src/config.rs
parent8d443c2e841505dd9a09d50dbb24a2a5956ecbd7 (diff)
downloadniri-d8a511bbac8d487c537dc325d105c1b07ff9c0cf.tar.gz
niri-d8a511bbac8d487c537dc325d105c1b07ff9c0cf.tar.bz2
niri-d8a511bbac8d487c537dc325d105c1b07ff9c0cf.zip
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.
Diffstat (limited to 'src/config.rs')
-rw-r--r--src/config.rs28
1 files changed, 28 insertions, 0 deletions
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<Color> 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<Bind>);
@@ -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 {