Skip to content

Commit

Permalink
[feat] Altgr modifier key
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
samsonnagamani authored and Shinyzenith committed Jun 30, 2023
1 parent 0318d82 commit d9f121c
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 1 deletion.
2 changes: 2 additions & 0 deletions docs/swhkd-keys.5.scd
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ swhkd - Hotkey daemon inspired by sxhkd written in Rust
- Mod4
- Alt
- Mod1
- Altgr
- Mod5
- Shift

# VALID KEYS
Expand Down
3 changes: 3 additions & 0 deletions swhkd/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ pub struct Hotkey {
pub enum Modifier {
Super,
Alt,
Altgr,
Control,
Shift,
Any,
Expand Down Expand Up @@ -452,6 +453,8 @@ pub fn parse_contents(path: PathBuf, contents: String) -> Result<Vec<Mode>, Erro
("mod4", Modifier::Super),
("alt", Modifier::Alt),
("mod1", Modifier::Alt),
("altgr", Modifier::Altgr),
("mod5", Modifier::Altgr),
("shift", Modifier::Shift),
("any", Modifier::Any),
]);
Expand Down
2 changes: 1 addition & 1 deletion swhkd/src/daemon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ async fn main() -> Result<(), Box<dyn Error>> {
(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),
Expand Down
8 changes: 8 additions & 0 deletions swhkd/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,9 @@ control + 5
alt + 2
notify-send 'Hello world!'
altgr + i
notify-send 'Hello world!'
super + z
notify-send 'Hello world!'
";
Expand All @@ -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],
Expand Down

0 comments on commit d9f121c

Please sign in to comment.