1
0
Fork 0
forked from wry/wry

config: fix some leftover personal settings

This commit is contained in:
Julian Orth 2022-05-02 17:43:02 +02:00
parent 56d3c5fce9
commit cb0383777d

View file

@ -9,9 +9,8 @@ use {
mods::{Modifiers, ALT, CTRL, SHIFT}, mods::{Modifiers, ALT, CTRL, SHIFT},
syms::{ syms::{
SYM_Super_L, SYM_c, SYM_d, SYM_f, SYM_h, SYM_j, SYM_k, SYM_l, SYM_m, SYM_p, SYM_q, SYM_Super_L, SYM_c, SYM_d, SYM_f, SYM_h, SYM_j, SYM_k, SYM_l, SYM_m, SYM_p, SYM_q,
SYM_r, SYM_t, SYM_u, SYM_v, SYM_F1, SYM_F10, SYM_F11, SYM_F12, SYM_F13, SYM_F14, SYM_r, SYM_t, SYM_u, SYM_v, SYM_F1, SYM_F10, SYM_F11, SYM_F12, SYM_F2, SYM_F3,
SYM_F15, SYM_F16, SYM_F17, SYM_F18, SYM_F19, SYM_F2, SYM_F20, SYM_F21, SYM_F22, SYM_F4, SYM_F5, SYM_F6, SYM_F7, SYM_F8, SYM_F9,
SYM_F23, SYM_F24, SYM_F25, SYM_F3, SYM_F4, SYM_F5, SYM_F6, SYM_F7, SYM_F8, SYM_F9,
}, },
}, },
quit, reload, quit, reload,
@ -64,35 +63,21 @@ fn configure_seat(s: Seat) {
]; ];
for (i, sym) in fnkeys.into_iter().enumerate() { for (i, sym) in fnkeys.into_iter().enumerate() {
s.bind(CTRL | ALT | sym, move || switch_to_vt(i as u32 + 1)); 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)); let ws = get_workspace(&format!("{}", i + 1));
s.bind(MOD | sym, move || s.show_workspace(ws)); s.bind(MOD | sym, move || s.show_workspace(ws));
s.bind(MOD | SHIFT | sym, move || s.set_workspace(ws)); s.bind(MOD | SHIFT | sym, move || s.set_workspace(ws));
} }
} }
pub fn configure() { fn setup_status() {
let seat = get_seat("default");
configure_seat(seat);
let handle_input_device = move |device: InputDevice| {
device.set_seat(seat);
};
input_devices().into_iter().for_each(handle_input_device);
on_new_input_device(handle_input_device);
{
let time_format: Vec<_> = StrftimeItems::new("%Y-%m-%d %H:%M:%S").collect(); let time_format: Vec<_> = StrftimeItems::new("%Y-%m-%d %H:%M:%S").collect();
let update_status = move || { let update_status = move || {
let status = format!("{}", Local::now().format_with_items(time_format.iter()),); let status = format!("{}", Local::now().format_with_items(time_format.iter()));
set_status(&status); set_status(&status);
}; };
update_status(); update_status();
// Sleep until the time becomes a multiple of 5 seconds
let initial = { let initial = {
let now = Local::now(); let now = Local::now();
5000 - (now.second() * 1000 + now.timestamp_subsec_millis()) % 5000 5000 - (now.second() * 1000 + now.timestamp_subsec_millis()) % 5000
@ -103,8 +88,22 @@ pub fn configure() {
Some(Duration::from_secs(5)), Some(Duration::from_secs(5)),
); );
timer.on_tick(update_status); timer.on_tick(update_status);
} }
pub fn configure() {
// Configure seats and input devices
let seat = get_seat("default");
configure_seat(seat);
let handle_input_device = move |device: InputDevice| {
device.set_seat(seat);
};
input_devices().into_iter().for_each(handle_input_device);
on_new_input_device(handle_input_device);
// Configure the status message
setup_status();
// Start programs
on_graphics_initialized(|| { on_graphics_initialized(|| {
Command::new("mako").spawn(); Command::new("mako").spawn();
}); });