autocommit 2022-04-01 01:44:10 CEST
This commit is contained in:
parent
ab4ac883ee
commit
2dd433aa04
32 changed files with 626 additions and 139 deletions
|
|
@ -1,98 +1,65 @@
|
|||
use jay_config::embedded::grab_input_device;
|
||||
use jay_config::input::{
|
||||
InputDevice, CAP_KEYBOARD, CAP_POINTER,
|
||||
};
|
||||
use jay_config::input::{InputDevice, CAP_KEYBOARD, CAP_POINTER};
|
||||
use jay_config::keyboard::mods::{Modifiers, ALT, CTRL, SHIFT};
|
||||
use jay_config::keyboard::syms::{
|
||||
SYM_Super_L, SYM_b, SYM_comma, SYM_d, SYM_f, SYM_h, SYM_j, SYM_k, SYM_l, SYM_m, SYM_p,
|
||||
SYM_period, SYM_q, SYM_r, SYM_t, SYM_v, SYM_y, SYM_F1, SYM_F10, SYM_F11, SYM_F12, SYM_F2,
|
||||
SYM_F3, SYM_F4, SYM_F5, SYM_F6, SYM_F7, SYM_F8, SYM_F9,
|
||||
SYM_Super_L, SYM_b, SYM_d, SYM_f, SYM_h, SYM_j, SYM_k, SYM_l, SYM_m, SYM_p, SYM_q, SYM_t,
|
||||
SYM_v, SYM_y, SYM_F1, SYM_F10, SYM_F11, SYM_F12, SYM_F13, SYM_F14, SYM_F15, SYM_F16, SYM_F17,
|
||||
SYM_F18, SYM_F19, SYM_F2, SYM_F20, SYM_F21, SYM_F22, SYM_F23, SYM_F24, SYM_F25, SYM_F3, SYM_F4,
|
||||
SYM_F5, SYM_F6, SYM_F7, SYM_F8, SYM_F9,
|
||||
};
|
||||
use jay_config::theme::{get_title_height, set_title_color, set_title_height, Color};
|
||||
use jay_config::Axis::{Horizontal, Vertical};
|
||||
use jay_config::Direction::{Down, Left, Right, Up};
|
||||
use jay_config::{
|
||||
config, create_seat, input_devices, on_new_input_device, quit, switch_to_vt, Command, Seat,
|
||||
config, create_seat, get_workspace, input_devices, on_new_input_device, quit, switch_to_vt,
|
||||
Command, Seat,
|
||||
};
|
||||
use rand::Rng;
|
||||
|
||||
const MOD: Modifiers = ALT;
|
||||
|
||||
fn configure_seat(s: Seat) {
|
||||
log::info!("Configuring seat {:?}", s);
|
||||
|
||||
let change_rate = move |delta| {
|
||||
let (rate, delay) = s.repeat_rate();
|
||||
let new_rate = rate - delta;
|
||||
let new_delay = delay + 10 * delta;
|
||||
log::info!("Changing repeat rate to {}/{}", new_rate, new_delay);
|
||||
s.set_repeat_rate(new_rate, new_delay);
|
||||
};
|
||||
|
||||
s.bind(CTRL | SHIFT | SYM_l, move || change_rate(-1));
|
||||
s.bind(CTRL | SHIFT | SYM_r, move || change_rate(1));
|
||||
|
||||
s.bind(MOD | SYM_comma, move || {
|
||||
let mut rng = rand::thread_rng();
|
||||
set_title_color(Color {
|
||||
r: rng.gen(),
|
||||
g: rng.gen(),
|
||||
b: rng.gen(),
|
||||
a: rng.gen(),
|
||||
})
|
||||
});
|
||||
|
||||
s.bind(MOD | SYM_period, move || {
|
||||
set_title_height(get_title_height() + 1)
|
||||
});
|
||||
|
||||
s.bind(MOD | SYM_h, move || s.focus(Left));
|
||||
s.bind(MOD | SYM_j, move || s.focus(Down));
|
||||
s.bind(MOD | SYM_k, move || s.focus(Up));
|
||||
s.bind(MOD | SYM_l, move || s.focus(Right));
|
||||
|
||||
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_f, move || {
|
||||
s.focus_parent();
|
||||
});
|
||||
|
||||
s.bind(MOD | SHIFT | SYM_f, move || {
|
||||
s.toggle_floating();
|
||||
});
|
||||
|
||||
s.bind(MOD | SHIFT | SYM_h, move || s.move_(Left));
|
||||
s.bind(MOD | SHIFT | SYM_j, move || s.move_(Down));
|
||||
s.bind(MOD | SHIFT | SYM_k, move || s.move_(Up));
|
||||
s.bind(MOD | SHIFT | SYM_l, move || s.move_(Right));
|
||||
|
||||
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_f, move || s.focus_parent());
|
||||
|
||||
s.bind(MOD | SHIFT | SYM_f, move || s.toggle_floating());
|
||||
|
||||
s.bind(SYM_Super_L, || Command::new("alacritty").spawn());
|
||||
|
||||
s.bind(MOD | SYM_p, || Command::new("xeyes").spawn());
|
||||
|
||||
s.bind(MOD | SYM_q, quit);
|
||||
|
||||
s.bind(CTRL | ALT | SYM_F1, || switch_to_vt(1));
|
||||
s.bind(CTRL | ALT | SYM_F2, || switch_to_vt(2));
|
||||
s.bind(CTRL | ALT | SYM_F3, || switch_to_vt(3));
|
||||
s.bind(CTRL | ALT | SYM_F4, || switch_to_vt(4));
|
||||
s.bind(CTRL | ALT | SYM_F5, || switch_to_vt(5));
|
||||
s.bind(CTRL | ALT | SYM_F6, || switch_to_vt(6));
|
||||
s.bind(CTRL | ALT | SYM_F7, || switch_to_vt(7));
|
||||
s.bind(CTRL | ALT | SYM_F8, || switch_to_vt(8));
|
||||
s.bind(CTRL | ALT | SYM_F9, || switch_to_vt(9));
|
||||
s.bind(CTRL | ALT | SYM_F10, || switch_to_vt(10));
|
||||
s.bind(CTRL | ALT | SYM_F11, || switch_to_vt(11));
|
||||
s.bind(CTRL | ALT | SYM_F12, || switch_to_vt(12));
|
||||
let fnkeys = [
|
||||
SYM_F1, SYM_F2, SYM_F3, SYM_F4, SYM_F5, SYM_F6, SYM_F7, SYM_F8, SYM_F9, SYM_F10, SYM_F11,
|
||||
SYM_F12,
|
||||
];
|
||||
for (i, sym) in fnkeys.into_iter().enumerate() {
|
||||
s.bind(CTRL | ALT | sym, move || switch_to_vt(i as u32 + 1));
|
||||
}
|
||||
|
||||
let fnkeys2 = [
|
||||
SYM_F13, SYM_F14, SYM_F15, SYM_F16, SYM_F17, SYM_F18, SYM_F19, SYM_F20, SYM_F21, SYM_F22,
|
||||
SYM_F23, SYM_F24, SYM_F25,
|
||||
];
|
||||
for (i, sym) in fnkeys2.into_iter().enumerate() {
|
||||
let ws = get_workspace(&format!("{}", i + 1));
|
||||
s.bind(MOD | sym, move || s.show_workspace(ws));
|
||||
}
|
||||
|
||||
fn do_grab(s: Seat, grab: bool) {
|
||||
for device in s.input_devices() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue