aboutsummaryrefslogtreecommitdiff
path: root/niri-config/src
diff options
context:
space:
mode:
Diffstat (limited to 'niri-config/src')
-rw-r--r--niri-config/src/binds.rs14
-rw-r--r--niri-config/src/lib.rs2
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.