Skip to content

GlazeWM is a tiling window manager for macOS and Windows inspired by i3wm.

fix: add `oem_8` and `oem_102` key parsing (#1324)

Lars Bergerff76eff08869
diff --git a/README.md b/README.md
index b0485b01..c1b9a03c 100644
--- a/README.md
+++ b/README.md
@@ -147,67 +147,69 @@ keybindings:
<details>
<summary>Keys list</summary>
-| Key | Description |
-| --------------------- | ------------------------------------------------------------------ |
-| `a` - `z` | Alphabetical letter keys |
-| `0` - `9` | Number keys |
-| `numpad0` - `numpad9` | Numerical keypad keys |
-| `f1` - `f24` | Function keys |
-| `shift` | Either left or right SHIFT key |
-| `lshift` | The left SHIFT key |
-| `rshift` | The right SHIFT key |
-| `control` | Either left or right CTRL key |
-| `lctrl` | The left CTRL key |
-| `rctrl` | The right CTRL key |
-| `alt` | Either left or right ALT key |
-| `lalt` | The left ALT key |
-| `ralt` | The right ALT key |
-| `lwin` | The left ⊞ Windows logo key |
-| `rwin` | The right ⊞ Windows logo key |
-| `space` | The spacebar key |
-| `escape` | The ESCAPE key |
-| `back` | The BACKSPACE key |
-| `tab` | The TAB key |
-| `enter` | The ENTER key |
-| `left` | The ← arrow key |
-| `right` | The → arrow key |
-| `up` | The ↑ arrow key |
-| `down` | The ↓ arrow key |
-| `num_lock` | The NUM LOCK key |
-| `scroll_lock` | The SCROLL LOCK key |
-| `caps_lock` | The CAPS LOCK key |
-| `page_up` | The PAGE UP key |
-| `page_down` | The PAGE DOWN key |
-| `insert` | The INSERT key |
-| `delete` | The DELETE key |
-| `end` | The END key |
-| `home` | The HOME key |
-| `print_screen` | The PRINT SCREEN key |
-| `multiply` | The `*` key (only on numpad) |
-| `add` | The `+` key (only on numpad) |
-| `subtract` | The `-` key (only on numpad) |
-| `decimal` | The DEL key (only on numpad) |
-| `divide` | The `/` key (only on numpad) |
-| `volume_up` | The volume up key |
-| `volume_down` | The volume down key |
-| `volume_mute` | The volume mute key |
-| `media_next_track` | The media next track key |
-| `media_prev_track` | The media prev track key |
-| `media_stop` | The media stop key |
-| `media_play_pause` | The media play/pause key |
-| `oem_semicolon` | The `;`/`:` key on a US standard keyboard (varies by keyboard) |
-| `oem_question` | The `/`/`?` key on a US standard keyboard (varies by keyboard) |
-| `oem_tilde` | The `` ` ``/`~` key on a US standard keyboard (varies by keyboard) |
-| `oem_open_brackets` | The `[`/`{` key on a US standard keyboard (varies by keyboard) |
-| `oem_pipe` | The `\`/`\|` key on a US standard keyboard (varies by keyboard) |
-| `oem_close_brackets` | The `]`/`}` key on a US standard keyboard (varies by keyboard) |
-| `oem_quotes` | The `'`/`"` key on a US standard keyboard (varies by keyboard) |
-| `oem_plus` | The `=`/`+` key on a US standard keyboard (varies by keyboard) |
-| `oem_comma` | The `,`/`<` key on a US standard keyboard (varies by keyboard) |
-| `oem_minus` | The `-`/`_` key on a US standard keyboard (varies by keyboard) |
-| `oem_period` | The `.`/`>` key on a US standard keyboard (varies by keyboard) |
-| `muhenkan` | The 無変換 (non-convert) key for Japanese keyboard layouts |
-| `henkan` | The 変換 (convert) key for Japanese keyboard layouts |
+| Key | Description |
+| --------------------- | ------------------------------------------------------------------------- |
+| `a` - `z` | Alphabetical letter keys |
+| `0` - `9` | Number keys |
+| `numpad0` - `numpad9` | Numerical keypad keys |
+| `f1` - `f24` | Function keys |
+| `shift` | Either left or right SHIFT key |
+| `lshift` | The left SHIFT key |
+| `rshift` | The right SHIFT key |
+| `control` | Either left or right CTRL key |
+| `lctrl` | The left CTRL key |
+| `rctrl` | The right CTRL key |
+| `alt` | Either left or right ALT key |
+| `lalt` | The left ALT key |
+| `ralt` | The right ALT key |
+| `lwin` | The left ⊞ Windows logo key |
+| `rwin` | The right ⊞ Windows logo key |
+| `space` | The spacebar key |
+| `escape` | The ESCAPE key |
+| `back` | The BACKSPACE key |
+| `tab` | The TAB key |
+| `enter` | The ENTER key |
+| `left` | The ← arrow key |
+| `right` | The → arrow key |
+| `up` | The ↑ arrow key |
+| `down` | The ↓ arrow key |
+| `num_lock` | The NUM LOCK key |
+| `scroll_lock` | The SCROLL LOCK key |
+| `caps_lock` | The CAPS LOCK key |
+| `page_up` | The PAGE UP key |
+| `page_down` | The PAGE DOWN key |
+| `insert` | The INSERT key |
+| `delete` | The DELETE key |
+| `end` | The END key |
+| `home` | The HOME key |
+| `print_screen` | The PRINT SCREEN key |
+| `multiply` | The `*` key (only on numpad) |
+| `add` | The `+` key (only on numpad) |
+| `subtract` | The `-` key (only on numpad) |
+| `decimal` | The DEL key (only on numpad) |
+| `divide` | The `/` key (only on numpad) |
+| `volume_up` | The volume up key |
+| `volume_down` | The volume down key |
+| `volume_mute` | The volume mute key |
+| `media_next_track` | The media next track key |
+| `media_prev_track` | The media prev track key |
+| `media_stop` | The media stop key |
+| `media_play_pause` | The media play/pause key |
+| `oem_semicolon` | The `;`/`:` key on a US standard keyboard (varies by keyboard) |
+| `oem_question` | The `/`/`?` key on a US standard keyboard (varies by keyboard) |
+| `oem_tilde` | The `` ` ``/`~` key on a US standard keyboard (varies by keyboard) |
+| `oem_open_brackets` | The `[`/`{` key on a US standard keyboard (varies by keyboard) |
+| `oem_pipe` | The `\`/`\|` key on a US standard keyboard (varies by keyboard) |
+| `oem_close_brackets` | The `]`/`}` key on a US standard keyboard (varies by keyboard) |
+| `oem_quotes` | The `'`/`"` key on a US standard keyboard (varies by keyboard) |
+| `oem_8` | The `` ` ``/`¬` key on a UK keyboard (varies by keyboard) |
+| `oem_102` | The `\`/`\|` key next to left Shift on ISO keyboards (varies by keyboard) |
+| `oem_plus` | The `=`/`+` key on a US standard keyboard (varies by keyboard) |
+| `oem_comma` | The `,`/`<` key on a US standard keyboard (varies by keyboard) |
+| `oem_minus` | The `-`/`_` key on a US standard keyboard (varies by keyboard) |
+| `oem_period` | The `.`/`>` key on a US standard keyboard (varies by keyboard) |
+| `muhenkan` | The 無変換 (non-convert) key for Japanese keyboard layouts |
+| `henkan` | The 変換 (convert) key for Japanese keyboard layouts |
</details>
diff --git a/packages/wm-platform/src/models/key.rs b/packages/wm-platform/src/models/key.rs
index fcd877ab..2b9c232b 100644
--- a/packages/wm-platform/src/models/key.rs
+++ b/packages/wm-platform/src/models/key.rs
@@ -195,6 +195,8 @@ pub enum Key {
OemPipe,
OemCloseBrackets,
OemQuotes,
+ Oem8,
+ Oem102,
OemPlus,
OemComma,
OemMinus,
@@ -405,6 +407,8 @@ impl_key_parsing! {
OemPipe => ["oem_pipe"],
OemCloseBrackets => ["oem_close_brackets"],
OemQuotes => ["oem_quotes"],
+ Oem8 => ["oem_8"],
+ Oem102 => ["oem_102"],
OemPlus => ["oem_plus"],
OemComma => ["oem_comma"],
OemMinus => ["oem_minus"],
diff --git a/packages/wm-platform/src/models/key_code.rs b/packages/wm-platform/src/models/key_code.rs
index 19c32fe8..b831492a 100644
--- a/packages/wm-platform/src/models/key_code.rs
+++ b/packages/wm-platform/src/models/key_code.rs
@@ -11,12 +11,12 @@ use windows::Win32::UI::Input::KeyboardAndMouse::{
VK_MEDIA_PREV_TRACK, VK_MEDIA_STOP, VK_MULTIPLY, VK_N, VK_NEXT,
VK_NONCONVERT, VK_NUMLOCK, VK_NUMPAD0, VK_NUMPAD1, VK_NUMPAD2,
VK_NUMPAD3, VK_NUMPAD4, VK_NUMPAD5, VK_NUMPAD6, VK_NUMPAD7, VK_NUMPAD8,
- VK_NUMPAD9, VK_O, VK_OEM_1, VK_OEM_2, VK_OEM_3, VK_OEM_4, VK_OEM_5,
- VK_OEM_6, VK_OEM_7, VK_OEM_COMMA, VK_OEM_MINUS, VK_OEM_PERIOD,
- VK_OEM_PLUS, VK_P, VK_PRIOR, VK_Q, VK_R, VK_RCONTROL, VK_RETURN,
- VK_RIGHT, VK_RMENU, VK_RSHIFT, VK_RWIN, VK_S, VK_SCROLL, VK_SNAPSHOT,
- VK_SPACE, VK_SUBTRACT, VK_T, VK_TAB, VK_U, VK_UP, VK_V, VK_VOLUME_DOWN,
- VK_VOLUME_MUTE, VK_VOLUME_UP, VK_W, VK_X, VK_Y, VK_Z,
+ VK_NUMPAD9, VK_O, VK_OEM_1, VK_OEM_102, VK_OEM_2, VK_OEM_3, VK_OEM_4,
+ VK_OEM_5, VK_OEM_6, VK_OEM_7, VK_OEM_8, VK_OEM_COMMA, VK_OEM_MINUS,
+ VK_OEM_PERIOD, VK_OEM_PLUS, VK_P, VK_PRIOR, VK_Q, VK_R, VK_RCONTROL,
+ VK_RETURN, VK_RIGHT, VK_RMENU, VK_RSHIFT, VK_RWIN, VK_S, VK_SCROLL,
+ VK_SNAPSHOT, VK_SPACE, VK_SUBTRACT, VK_T, VK_TAB, VK_U, VK_UP, VK_V,
+ VK_VOLUME_DOWN, VK_VOLUME_MUTE, VK_VOLUME_UP, VK_W, VK_X, VK_Y, VK_Z,
};
use crate::{Key, KeyCode};
@@ -206,6 +206,8 @@ impl_key_code_conversion! {
OemPipe => { windows: VK_OEM_5, macos: 0x2A, },
OemCloseBrackets => { windows: VK_OEM_6, macos: 0x1E, },
OemQuotes => { windows: VK_OEM_7, macos: 0x27, },
+ Oem8 => { windows: VK_OEM_8, },
+ Oem102 => { windows: VK_OEM_102, },
OemPlus => { windows: VK_OEM_PLUS, macos: 0x18, },
OemComma => { windows: VK_OEM_COMMA, macos: 0x2B, },
OemMinus => { windows: VK_OEM_MINUS, macos: 0x1B, },