Skip to content

Commit d9f121c

Browse files
samsonnagamaniShinyzenith
authored andcommitted
[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 <[email protected]> Signed-off-by: Aakash Sen Sharma <[email protected]>
1 parent 0318d82 commit d9f121c

File tree

4 files changed

+14
-1
lines changed

4 files changed

+14
-1
lines changed

docs/swhkd-keys.5.scd

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ swhkd - Hotkey daemon inspired by sxhkd written in Rust
1212
- Mod4
1313
- Alt
1414
- Mod1
15+
- Altgr
16+
- Mod5
1517
- Shift
1618

1719
# VALID KEYS

swhkd/src/config.rs

+3
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,7 @@ pub struct Hotkey {
228228
pub enum Modifier {
229229
Super,
230230
Alt,
231+
Altgr,
231232
Control,
232233
Shift,
233234
Any,
@@ -452,6 +453,8 @@ pub fn parse_contents(path: PathBuf, contents: String) -> Result<Vec<Mode>, Erro
452453
("mod4", Modifier::Super),
453454
("alt", Modifier::Alt),
454455
("mod1", Modifier::Alt),
456+
("altgr", Modifier::Altgr),
457+
("mod5", Modifier::Altgr),
455458
("shift", Modifier::Shift),
456459
("any", Modifier::Any),
457460
]);

swhkd/src/daemon.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ async fn main() -> Result<(), Box<dyn Error>> {
193193
(Key::KEY_LEFTMETA, config::Modifier::Super),
194194
(Key::KEY_RIGHTMETA, config::Modifier::Super),
195195
(Key::KEY_LEFTALT, config::Modifier::Alt),
196-
(Key::KEY_RIGHTALT, config::Modifier::Alt),
196+
(Key::KEY_RIGHTALT, config::Modifier::Altgr),
197197
(Key::KEY_LEFTCTRL, config::Modifier::Control),
198198
(Key::KEY_RIGHTCTRL, config::Modifier::Control),
199199
(Key::KEY_LEFTSHIFT, config::Modifier::Shift),

swhkd/src/tests.rs

+8
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,9 @@ control + 5
398398
alt + 2
399399
notify-send 'Hello world!'
400400
401+
altgr + i
402+
notify-send 'Hello world!'
403+
401404
super + z
402405
notify-send 'Hello world!'
403406
";
@@ -418,6 +421,11 @@ super + z
418421
vec![Modifier::Alt],
419422
"notify-send 'Hello world!'".to_string(),
420423
),
424+
Hotkey::new(
425+
evdev::Key::KEY_I,
426+
vec![Modifier::Altgr],
427+
"notify-send 'Hello world!'".to_string(),
428+
),
421429
Hotkey::new(
422430
evdev::Key::KEY_Z,
423431
vec![Modifier::Super],

0 commit comments

Comments
 (0)