From b6a4570a432335289ed66cf865ca3a4b3e4a1d10 Mon Sep 17 00:00:00 2001 From: Ivan Molodetskikh Date: Thu, 10 Aug 2023 17:24:07 +0400 Subject: input: Add bind for spawning alacritty --- src/input.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/input.rs') 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}"); + } + } } } } -- cgit