diff options
| author | Ivan Molodetskikh <yalterz@gmail.com> | 2023-08-10 17:24:07 +0400 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2023-08-10 17:24:07 +0400 |
| commit | b6a4570a432335289ed66cf865ca3a4b3e4a1d10 (patch) | |
| tree | 72e6ff1bf0c19e67debcce8c66b43985c6b75b39 | |
| parent | 89349f2f3df431ecee1f87d6609b4ae38aa28930 (diff) | |
| download | niri-b6a4570a432335289ed66cf865ca3a4b3e4a1d10.tar.gz niri-b6a4570a432335289ed66cf865ca3a4b3e4a1d10.tar.bz2 niri-b6a4570a432335289ed66cf865ca3a4b3e4a1d10.zip | |
input: Add bind for spawning alacritty
| -rw-r--r-- | src/input.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/input.rs b/src/input.rs index ca08c379..4fcfa98c 100644 --- a/src/input.rs +++ b/src/input.rs @@ -1,3 +1,5 @@ +use std::process::Command; + use smithay::backend::input::{ AbsolutePositionEvent, Axis, AxisSource, ButtonState, Event, InputBackend, InputEvent, KeyState, KeyboardKeyEvent, PointerAxisEvent, PointerButtonEvent, PointerMotionEvent, @@ -12,6 +14,7 @@ use crate::niri::Niri; enum InputAction { Quit, ChangeVt(i32), + SpawnTerminal, } impl Niri { @@ -45,6 +48,9 @@ impl Niri { let vt = (keysym - keysyms::KEY_XF86Switch_VT_1 + 1) as i32; FilterResult::Intercept(InputAction::ChangeVt(vt)) } + keysyms::KEY_t if mods.logo => { + FilterResult::Intercept(InputAction::SpawnTerminal) + } _ => FilterResult::Forward, } } else { @@ -62,6 +68,11 @@ impl Niri { InputAction::ChangeVt(vt) => { (*change_vt)(vt); } + InputAction::SpawnTerminal => { + if let Err(err) = Command::new("alacritty").spawn() { + warn!("error spawning alacritty: {err}"); + } + } } } } |
