Allow VoidSymbol keycode to be seen by wezterm (#759)

* allow voidsymbol for key code

* update docs, cleanup

* cleanup and fmt of files

* remove unnecessary inputs
This commit is contained in:
Chris authored and GitHub committed 2021-05-07 07:54:24 -07:00
1 parent d64b785290
commit 2add312c5c
5 files changed
+30 -1

No files matched your search

+1
View File
@@ -66,6 +66,7 @@ fn make_map() -> HashMap<String, KeyCode> {
RightAlt,
Pause,
CapsLock,
VoidSymbol,
PageUp,
PageDown,
End,
+25 -1
View File
@@ -219,7 +219,7 @@ all of these are meaningful on all platforms:
`Hyper`, `Super`, `Meta`, `Cancel`, `Backspace`, `Tab`, `Clear`, `Enter`,
`Shift`, `Escape`, `LeftShift`, `RightShift`, `Control`, `LeftControl`,
`RightControl`, `Alt`, `LeftAlt`, `RightAlt`, `Menu`, `LeftMenu`, `RightMenu`,
`Pause`, `CapsLock`, `PageUp`, `PageDown`, `End`, `Home`, `LeftArrow`,
`Pause`, `CapsLock`, `VoidSymbol`, `PageUp`, `PageDown`, `End`, `Home`, `LeftArrow`,
`RightArrow`, `UpArrow`, `DownArrow`, `Select`, `Print`, `Execute`,
`PrintScreen`, `Insert`, `Delete`, `Help`, `LeftWindows`, `RightWindows`,
`Applications`, `Sleep`, `Numpad0`, `Numpad1`, `Numpad2`, `Numpad3`,
@@ -244,6 +244,10 @@ Possible Modifier labels are:
* `SHIFT` - The shift key. Left and right are equivalent.
* `ALT`, `OPT`, `META` - these are all equivalent: on macOS the `Option` key,
on other systems the `Alt` or `Meta` key. Left and right are equivalent.
* `VoidSymbol` - This keycode is emitted in special cases where the original
function of the key has been removed. Such as in Linux and using `setxkbmap`.
`setxkbmap -option caps:none`. The `CapsLock` will no longer function as
before in all applications, instead emitting `VoidSymbol`.
You can combine modifiers using the `|` symbol (eg: `"CMD|CTRL"`).
@@ -283,6 +287,26 @@ return {
}
```
If you decide to change certain keys on the keyboard to `VoidSymbol` (like `CapsLock`),
then you can utilize it as a `LEADER` or any other part of key bindings. The
following example now uses `VoidSymbol` and uses `CapsLock` as a `LEADER`
without it affecting the shift / capital state as long as you have
`setxkbmap -option caps:none` configured.
```lua
local wezterm = require 'wezterm';
return {
-- timeout_milliseconds defaults to 1000 and can be omitted
-- for this example use `setxkbmap -option caps:none` in your terminal.
leader = { key="VoidSymbol", mods="", timeout_milliseconds=1000 },
keys = {
{key="|", mods="LEADER", action=wezterm.action{SplitHorizontal={domain="CurrentPaneDomain"}}},
{key="-", mods="LEADER", action=wezterm.action{SplitVertical={domain="CurrentPaneDomain"}}},
}
}
```
### Using Raw/Scan Codes for key bindings
In some cases it is desirable to assign keys based on their
+1
View File
@@ -300,6 +300,7 @@ impl super::TermWindow {
WK::RightAlt => KC::RightAlt,
WK::Pause => KC::Pause,
WK::CapsLock => KC::CapsLock,
WK::VoidSymbol => return Key::None,
WK::Select => KC::Select,
WK::Print => KC::Print,
WK::Execute => KC::Execute,
+1
View File
@@ -40,6 +40,7 @@ pub enum KeyCode {
RightAlt,
Pause,
CapsLock,
VoidSymbol,
PageUp,
PageDown,
End,
+2
View File
@@ -82,6 +82,8 @@ pub fn keysym_to_keycode(keysym: u32) -> Option<KeyCode> {
KEY_Menu => KeyCode::Applications,
KEY_Help => KeyCode::Help,
KEY_VoidSymbol => KeyCode::VoidSymbol,
i @ KEY_F1..=KEY_F12 => KeyCode::Function((1 + i - KEY_F1) as u8),
// numeric and function keypad keys