config: add some utility functions
This commit is contained in:
parent
518c1ad290
commit
56d3c5fce9
3 changed files with 15 additions and 15 deletions
|
|
@ -40,14 +40,12 @@ fn configure_seat(s: Seat) {
|
||||||
s.bind(MOD | SYM_d, move || s.create_split(Horizontal));
|
s.bind(MOD | SYM_d, move || s.create_split(Horizontal));
|
||||||
s.bind(MOD | SYM_v, move || s.create_split(Vertical));
|
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_t, move || s.toggle_split());
|
||||||
|
s.bind(MOD | SYM_m, move || s.toggle_mono());
|
||||||
s.bind(MOD | SYM_m, move || s.set_mono(!s.mono()));
|
s.bind(MOD | SYM_u, move || s.toggle_fullscreen());
|
||||||
|
|
||||||
s.bind(MOD | SYM_f, move || s.focus_parent());
|
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_c, move || s.close());
|
||||||
|
|
||||||
s.bind(MOD | SHIFT | SYM_f, move || s.toggle_floating());
|
s.bind(MOD | SHIFT | SYM_f, move || s.toggle_floating());
|
||||||
|
|
|
||||||
|
|
@ -84,29 +84,31 @@ impl Seat {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn mono(self) -> bool {
|
pub fn mono(self) -> bool {
|
||||||
let mut res = false;
|
get!(false).mono(self)
|
||||||
(|| res = get!().mono(self))();
|
|
||||||
res
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_mono(self, mono: bool) {
|
pub fn set_mono(self, mono: bool) {
|
||||||
get!().set_mono(self, mono)
|
get!().set_mono(self, mono)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn toggle_mono(self) {
|
||||||
|
self.set_mono(!self.mono());
|
||||||
|
}
|
||||||
|
|
||||||
pub fn split(self) -> Axis {
|
pub fn split(self) -> Axis {
|
||||||
let mut res = Axis::Horizontal;
|
get!(Axis::Horizontal).split(self)
|
||||||
(|| res = get!().split(self))();
|
|
||||||
res
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_split(self, axis: Axis) {
|
pub fn set_split(self, axis: Axis) {
|
||||||
get!().set_split(self, axis)
|
get!().set_split(self, axis)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn toggle_split(self) {
|
||||||
|
self.set_split(self.split().other());
|
||||||
|
}
|
||||||
|
|
||||||
pub fn input_devices(self) -> Vec<InputDevice> {
|
pub fn input_devices(self) -> Vec<InputDevice> {
|
||||||
let mut res = vec![];
|
get!().get_input_devices(Some(self))
|
||||||
(|| res = get!().get_input_devices(Some(self)))();
|
|
||||||
res
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn create_split(self, axis: Axis) {
|
pub fn create_split(self, axis: Axis) {
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ macro_rules! config {
|
||||||
|
|
||||||
macro_rules! get {
|
macro_rules! get {
|
||||||
() => {{
|
() => {{
|
||||||
get!(())
|
get!(Default::default())
|
||||||
}};
|
}};
|
||||||
($def:expr) => {{
|
($def:expr) => {{
|
||||||
#[allow(unused_unsafe)]
|
#[allow(unused_unsafe)]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue