From 7ad1fd3be976df44973dbd61f3838902d38e5fed Mon Sep 17 00:00:00 2001 From: Ivan Molodetskikh Date: Tue, 15 Aug 2023 12:50:44 +0400 Subject: Generalize Spawn action --- src/input.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/input.rs b/src/input.rs index d500c21e..028b7035 100644 --- a/src/input.rs +++ b/src/input.rs @@ -15,7 +15,7 @@ enum Action { None, Quit, ChangeVt(i32), - SpawnTerminal, + Spawn(String), CloseWindow, ToggleFullscreen, FocusLeft, @@ -73,7 +73,7 @@ fn action(comp_mod: CompositorMod, keysym: KeysymHandle, mods: ModifiersState) - #[allow(non_upper_case_globals)] // wat match modified { KEY_E => Action::Quit, - KEY_t => Action::SpawnTerminal, + KEY_t => Action::Spawn("alacritty".to_owned()), KEY_q => Action::CloseWindow, KEY_F => Action::ToggleFullscreen, KEY_h | KEY_Left if mods.ctrl => Action::MoveLeft, @@ -142,8 +142,8 @@ impl Niri { Action::ChangeVt(vt) => { (*change_vt)(vt); } - Action::SpawnTerminal => { - if let Err(err) = Command::new("alacritty").spawn() { + Action::Spawn(command) => { + if let Err(err) = Command::new(command).spawn() { warn!("error spawning alacritty: {err}"); } } -- cgit