diff options
| author | Ivan Molodetskikh <yalterz@gmail.com> | 2025-09-30 08:33:43 +0300 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2025-10-02 09:38:17 +0300 |
| commit | eff41ab716dd36cbcf13cae2484907e01a14bbcc (patch) | |
| tree | 11bd50af94e09523b7ccbae28ae2d23b07ee5b39 | |
| parent | 0673260249d173997298b85f3a84753db71eaa88 (diff) | |
| download | niri-eff41ab716dd36cbcf13cae2484907e01a14bbcc.tar.gz niri-eff41ab716dd36cbcf13cae2484907e01a14bbcc.tar.bz2 niri-eff41ab716dd36cbcf13cae2484907e01a14bbcc.zip | |
config: Add merging for SwitchBinds
| -rw-r--r-- | niri-config/src/binds.rs | 14 | ||||
| -rw-r--r-- | niri-config/src/lib.rs | 2 |
2 files changed, 14 insertions, 2 deletions
diff --git a/niri-config/src/binds.rs b/niri-config/src/binds.rs index c5b4e6ff..8a09445d 100644 --- a/niri-config/src/binds.rs +++ b/niri-config/src/binds.rs @@ -12,7 +12,7 @@ use smithay::input::keyboard::keysyms::KEY_NoSymbol; use smithay::input::keyboard::xkb::{keysym_from_name, KEYSYM_CASE_INSENSITIVE}; use smithay::input::keyboard::Keysym; -use crate::utils::expect_only_children; +use crate::utils::{expect_only_children, MergeWith}; #[derive(Debug, Default, PartialEq)] pub struct Binds(pub Vec<Bind>); @@ -77,6 +77,18 @@ pub struct SwitchBinds { pub tablet_mode_off: Option<SwitchAction>, } +impl MergeWith<SwitchBinds> for SwitchBinds { + fn merge_with(&mut self, part: &SwitchBinds) { + merge_clone_opt!( + (self, part), + lid_open, + lid_close, + tablet_mode_on, + tablet_mode_off, + ); + } +} + #[derive(knuffel::Decode, Debug, Clone, PartialEq)] pub struct SwitchAction { #[knuffel(child, unwrap(arguments))] diff --git a/niri-config/src/lib.rs b/niri-config/src/lib.rs index 14a93332..44b22a18 100644 --- a/niri-config/src/lib.rs +++ b/niri-config/src/lib.rs @@ -195,7 +195,7 @@ where "gestures" => m_replace!(gestures), "overview" => m_replace!(overview), "xwayland-satellite" => m_replace!(xwayland_satellite), - "switch-events" => m_replace!(switch_events), + "switch-events" => m_merge!(switch_events), "debug" => m_replace!(debug), // Multipart sections. |
