diff --git a/default-config/src/lib.rs b/default-config/src/lib.rs index aa289e7a..c197b0b8 100644 --- a/default-config/src/lib.rs +++ b/default-config/src/lib.rs @@ -40,14 +40,12 @@ fn configure_seat(s: Seat) { s.bind(MOD | SYM_d, move || s.create_split(Horizontal)); s.bind(MOD | SYM_v, move || s.create_split(Vertical)); - s.bind(MOD | SYM_t, move || s.set_split(s.split().other())); - - s.bind(MOD | SYM_m, move || s.set_mono(!s.mono())); + s.bind(MOD | SYM_t, move || s.toggle_split()); + s.bind(MOD | SYM_m, move || s.toggle_mono()); + s.bind(MOD | SYM_u, move || s.toggle_fullscreen()); s.bind(MOD | SYM_f, move || s.focus_parent()); - s.bind(MOD | SYM_u, move || s.toggle_fullscreen()); - s.bind(MOD | SHIFT | SYM_c, move || s.close()); s.bind(MOD | SHIFT | SYM_f, move || s.toggle_floating()); diff --git a/jay-config/src/input.rs b/jay-config/src/input.rs index 4eba5e35..33a2c306 100644 --- a/jay-config/src/input.rs +++ b/jay-config/src/input.rs @@ -84,29 +84,31 @@ impl Seat { } pub fn mono(self) -> bool { - let mut res = false; - (|| res = get!().mono(self))(); - res + get!(false).mono(self) } pub fn set_mono(self, mono: bool) { get!().set_mono(self, mono) } + pub fn toggle_mono(self) { + self.set_mono(!self.mono()); + } + pub fn split(self) -> Axis { - let mut res = Axis::Horizontal; - (|| res = get!().split(self))(); - res + get!(Axis::Horizontal).split(self) } pub fn set_split(self, axis: Axis) { get!().set_split(self, axis) } + pub fn toggle_split(self) { + self.set_split(self.split().other()); + } + pub fn input_devices(self) -> Vec { - let mut res = vec![]; - (|| res = get!().get_input_devices(Some(self)))(); - res + get!().get_input_devices(Some(self)) } pub fn create_split(self, axis: Axis) { diff --git a/jay-config/src/macros.rs b/jay-config/src/macros.rs index 90f0725d..ce1f5949 100644 --- a/jay-config/src/macros.rs +++ b/jay-config/src/macros.rs @@ -17,7 +17,7 @@ macro_rules! config { macro_rules! get { () => {{ - get!(()) + get!(Default::default()) }}; ($def:expr) => {{ #[allow(unused_unsafe)]