From d9f121ccb170834281cbe1b1ee153540a43cf620 Mon Sep 17 00:00:00 2001 From: Samson Nagamani Date: Mon, 26 Jun 2023 20:48:57 +0100 Subject: [PATCH] [feat] Altgr modifier key * Added "Alt graph" or "Alt gr" modifier key. Right alt key will no longer behave like the left alt key. * Modified test to include "Altgr" modifier * Added altgr/mod5 modifier keys to manual Signed-off-by: Samson Nagamani Signed-off-by: Aakash Sen Sharma --- docs/swhkd-keys.5.scd | 2 ++ swhkd/src/config.rs | 3 +++ swhkd/src/daemon.rs | 2 +- swhkd/src/tests.rs | 8 ++++++++ 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/docs/swhkd-keys.5.scd b/docs/swhkd-keys.5.scd index 18abdfe..76bb849 100644 --- a/docs/swhkd-keys.5.scd +++ b/docs/swhkd-keys.5.scd @@ -12,6 +12,8 @@ swhkd - Hotkey daemon inspired by sxhkd written in Rust - Mod4 - Alt - Mod1 + - Altgr + - Mod5 - Shift # VALID KEYS diff --git a/swhkd/src/config.rs b/swhkd/src/config.rs index 09dd886..a2dac65 100644 --- a/swhkd/src/config.rs +++ b/swhkd/src/config.rs @@ -228,6 +228,7 @@ pub struct Hotkey { pub enum Modifier { Super, Alt, + Altgr, Control, Shift, Any, @@ -452,6 +453,8 @@ pub fn parse_contents(path: PathBuf, contents: String) -> Result, Erro ("mod4", Modifier::Super), ("alt", Modifier::Alt), ("mod1", Modifier::Alt), + ("altgr", Modifier::Altgr), + ("mod5", Modifier::Altgr), ("shift", Modifier::Shift), ("any", Modifier::Any), ]); diff --git a/swhkd/src/daemon.rs b/swhkd/src/daemon.rs index 5fdfc38..74104ea 100644 --- a/swhkd/src/daemon.rs +++ b/swhkd/src/daemon.rs @@ -193,7 +193,7 @@ async fn main() -> Result<(), Box> { (Key::KEY_LEFTMETA, config::Modifier::Super), (Key::KEY_RIGHTMETA, config::Modifier::Super), (Key::KEY_LEFTALT, config::Modifier::Alt), - (Key::KEY_RIGHTALT, config::Modifier::Alt), + (Key::KEY_RIGHTALT, config::Modifier::Altgr), (Key::KEY_LEFTCTRL, config::Modifier::Control), (Key::KEY_RIGHTCTRL, config::Modifier::Control), (Key::KEY_LEFTSHIFT, config::Modifier::Shift), diff --git a/swhkd/src/tests.rs b/swhkd/src/tests.rs index b0785d9..c9c7f3e 100644 --- a/swhkd/src/tests.rs +++ b/swhkd/src/tests.rs @@ -398,6 +398,9 @@ control + 5 alt + 2 notify-send 'Hello world!' +altgr + i + notify-send 'Hello world!' + super + z notify-send 'Hello world!' "; @@ -418,6 +421,11 @@ super + z vec![Modifier::Alt], "notify-send 'Hello world!'".to_string(), ), + Hotkey::new( + evdev::Key::KEY_I, + vec![Modifier::Altgr], + "notify-send 'Hello world!'".to_string(), + ), Hotkey::new( evdev::Key::KEY_Z, vec![Modifier::Super],