diff --git a/default-config/src/lib.rs b/default-config/src/lib.rs index c197b0b8..ed9b91ca 100644 --- a/default-config/src/lib.rs +++ b/default-config/src/lib.rs @@ -9,9 +9,8 @@ use { mods::{Modifiers, ALT, CTRL, SHIFT}, 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_r, SYM_t, SYM_u, SYM_v, 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, + SYM_r, SYM_t, SYM_u, SYM_v, SYM_F1, SYM_F10, SYM_F11, SYM_F12, SYM_F2, SYM_F3, + SYM_F4, SYM_F5, SYM_F6, SYM_F7, SYM_F8, SYM_F9, }, }, quit, reload, @@ -64,20 +63,35 @@ fn configure_seat(s: Seat) { ]; 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)); s.bind(MOD | SHIFT | sym, move || s.set_workspace(ws)); } } +fn setup_status() { + let time_format: Vec<_> = StrftimeItems::new("%Y-%m-%d %H:%M:%S").collect(); + let update_status = move || { + let status = format!("{}", Local::now().format_with_items(time_format.iter())); + set_status(&status); + }; + update_status(); + // Sleep until the time becomes a multiple of 5 seconds + let initial = { + let now = Local::now(); + 5000 - (now.second() * 1000 + now.timestamp_subsec_millis()) % 5000 + }; + let timer = get_timer("status_timer"); + timer.program( + Duration::from_millis(initial as u64), + Some(Duration::from_secs(5)), + ); + 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| { @@ -86,25 +100,10 @@ pub fn configure() { 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 update_status = move || { - let status = format!("{}", Local::now().format_with_items(time_format.iter()),); - set_status(&status); - }; - update_status(); - let initial = { - let now = Local::now(); - 5000 - (now.second() * 1000 + now.timestamp_subsec_millis()) % 5000 - }; - let timer = get_timer("status_timer"); - timer.program( - Duration::from_millis(initial as u64), - Some(Duration::from_secs(5)), - ); - timer.on_tick(update_status); - } + // Configure the status message + setup_status(); + // Start programs on_graphics_initialized(|| { Command::new("mako").spawn(); });