|
1 | 1 | ---@meta |
2 | 2 |
|
3 | | --- TODO: Make key and mods more specific |
| 3 | +---TODO: Make key and mods more specific |
4 | 4 |
|
5 | 5 | ---@alias KeyAssignment |
6 | 6 | ---|"ActivateCommandPalette" |
|
85 | 85 | ---|"TogglePaneZoomState" |
86 | 86 |
|
87 | 87 | ---@class KeyNoAction |
88 | | --- A single unicode character, like 'A' or 'a'. Pay attention to the case of the text that you use |
89 | | --- and the state of the SHIFT modifier, as this matters whether 'A' or 'a' is matched. |
90 | | --- |
91 | | --- Alternatively you can use on the following keycode identifiers, although note that not all of |
92 | | --- these are meaningful on all platforms: |
93 | | --- |
94 | | --- Hyper, Super, Meta, Cancel, Backspace, Tab, Clear, Enter, Shift, Escape, LeftShift, RightShift, |
95 | | --- Control, LeftControl, RightControl, Alt, LeftAlt, RightAlt, Menu, LeftMenu, RightMenu, Pause, |
96 | | --- CapsLock, VoidSymbol, PageUp, PageDown, End, Home, LeftArrow, RightArrow, UpArrow, DownArrow, |
97 | | --- Select, Print, Execute, PrintScreen, Insert, Delete, Help, LeftWindows, RightWindows, |
98 | | --- Applications, Sleep, Numpad0, Numpad1, Numpad2, Numpad3, Numpad4, Numpad5, Numpad6, Numpad7, |
99 | | --- Numpad8, Numpad9, Multiply, Add, Separator, Subtract, Decimal, Divide, NumLock, ScrollLock, |
100 | | --- BrowserBack, BrowserForward, BrowserRefresh, BrowserStop, BrowserSearch, BrowserFavorites, |
101 | | --- BrowserHome, VolumeMute, VolumeDown, VolumeUp, MediaNextTrack, MediaPrevTrack, MediaStop, |
102 | | --- MediaPlayPause, ApplicationLeftArrow, ApplicationRightArrow, ApplicationUpArrow, |
103 | | --- ApplicationDownArrow, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, F16, F17, |
104 | | --- F18, F19, F20, F21, F22, F23, F24. |
105 | | --- |
106 | | --- The key value can refer either to the physical position of a key on an ANSI US keyboard or to the |
107 | | --- post-keyboard-layout-mapped value produced by a key press. |
108 | | --- |
109 | | --- You can explicitly assign using the physical position by adding a phys: prefix to the value, for |
110 | | --- example: `key="phys:A"`. This will match key presses for the key that would be in the position of |
111 | | --- the A key on an ANSI US keyboard. |
112 | | --- |
113 | | --- You can explicitly assign the mapped key by adding a mapped: |
114 | | --- prefix to the value, for example: key="mapped:a" will match a |
115 | | --- key press where the OS keyboard layout produces a, regardless of |
116 | | --- its physical position. |
117 | | --- |
118 | | --- If you omit an explicit prefix, wezterm will assume phys: and use the physical position of the |
119 | | --- specified key. |
120 | | --- |
121 | | --- The default key assignments listed above use `phys:`. In previous releases there was no physical |
122 | | --- position support and those assignments were all `mapped:`. |
123 | | --- |
124 | | --- When upgrading from earlier releases, if you had `{key="N", mods="CMD", ..}` in your config, you |
125 | | --- will need to change it to either `{key="N", mods="CMD|SHIFT", ..}` or `{ key="mapped:N", |
126 | | --- mods="CMD", ..}` in order to continue to respect the SHIFT modifier. |
127 | | --- |
128 | | --- The `key_map_preference` option controls how keys without an explicit `phys:` or `mapped:` prefix |
129 | | --- are treated. If `key_map_preference = "Mapped"` (the default), then `mapped:` is assumed. If |
130 | | --- `key_map_preference = "Physical"` then `phys:` is assumed. |
131 | | --- |
132 | | --- The default key assignments will respect `key_map_preference`. |
133 | | --- |
134 | | --- In some cases, wezterm may not know how to represent a key event in either its phys: or mapped: |
135 | | --- forms. In that case, you may wish to define an assignment in terms of the underlying operating |
136 | | --- system key code, using a `raw: prefix`. |
137 | | --- |
138 | | --- Similar in concept to the `phys:` mapping described above, the `raw:` mapping is independent of |
139 | | --- the OS keyboard layout. Raw codes are hardware and windowing system dependent, so there is no |
140 | | --- portable way to list which key does what. |
141 | | --- |
142 | | --- To discover these values, you can set `debug_key_events = true` and press the keys of interest. |
143 | | --- |
144 | | --- You can specify a raw key value of 123 by using `key="raw:123"` in your config rather than one of |
145 | | --- the other key values. |
146 | | --- |
| 88 | +---A single unicode character, like 'A' or 'a'. Pay attention to the case of the text that you use |
| 89 | +---and the state of the SHIFT modifier, as this matters whether 'A' or 'a' is matched. |
| 90 | +--- |
| 91 | +---Alternatively you can use on the following keycode identifiers, although note that not all of |
| 92 | +---these are meaningful on all platforms: |
| 93 | +--- |
| 94 | +---Hyper, Super, Meta, Cancel, Backspace, Tab, Clear, Enter, Shift, Escape, LeftShift, RightShift, |
| 95 | +---Control, LeftControl, RightControl, Alt, LeftAlt, RightAlt, Menu, LeftMenu, RightMenu, Pause, |
| 96 | +---CapsLock, VoidSymbol, PageUp, PageDown, End, Home, LeftArrow, RightArrow, UpArrow, DownArrow, |
| 97 | +---Select, Print, Execute, PrintScreen, Insert, Delete, Help, LeftWindows, RightWindows, |
| 98 | +---Applications, Sleep, Numpad0, Numpad1, Numpad2, Numpad3, Numpad4, Numpad5, Numpad6, Numpad7, |
| 99 | +---Numpad8, Numpad9, Multiply, Add, Separator, Subtract, Decimal, Divide, NumLock, ScrollLock, |
| 100 | +---BrowserBack, BrowserForward, BrowserRefresh, BrowserStop, BrowserSearch, BrowserFavorites, |
| 101 | +---BrowserHome, VolumeMute, VolumeDown, VolumeUp, MediaNextTrack, MediaPrevTrack, MediaStop, |
| 102 | +---MediaPlayPause, ApplicationLeftArrow, ApplicationRightArrow, ApplicationUpArrow, |
| 103 | +---ApplicationDownArrow, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, F16, F17, |
| 104 | +---F18, F19, F20, F21, F22, F23, F24. |
| 105 | +--- |
| 106 | +---The key value can refer either to the physical position of a key on an ANSI US keyboard or to the |
| 107 | +---post-keyboard-layout-mapped value produced by a key press. |
| 108 | +--- |
| 109 | +---You can explicitly assign using the physical position by adding a phys: prefix to the value, for |
| 110 | +---example: `key="phys:A"`. This will match key presses for the key that would be in the position of |
| 111 | +---the A key on an ANSI US keyboard. |
| 112 | +--- |
| 113 | +---You can explicitly assign the mapped key by adding a mapped: |
| 114 | +---prefix to the value, for example: key="mapped:a" will match a |
| 115 | +---key press where the OS keyboard layout produces a, regardless of |
| 116 | +---its physical position. |
| 117 | +--- |
| 118 | +---If you omit an explicit prefix, wezterm will assume phys: and use the physical position of the |
| 119 | +---specified key. |
| 120 | +--- |
| 121 | +---The default key assignments listed above use `phys:`. In previous releases there was no physical |
| 122 | +---position support and those assignments were all `mapped:`. |
| 123 | +--- |
| 124 | +---When upgrading from earlier releases, if you had `{key="N", mods="CMD", ..}` in your config, you |
| 125 | +---will need to change it to either `{key="N", mods="CMD|SHIFT", ..}` or `{ key="mapped:N", |
| 126 | +---mods="CMD", ..}` in order to continue to respect the SHIFT modifier. |
| 127 | +--- |
| 128 | +---The `key_map_preference` option controls how keys without an explicit `phys:` or `mapped:` prefix |
| 129 | +---are treated. If `key_map_preference = "Mapped"` (the default), then `mapped:` is assumed. If |
| 130 | +---`key_map_preference = "Physical"` then `phys:` is assumed. |
| 131 | +--- |
| 132 | +---The default key assignments will respect `key_map_preference`. |
| 133 | +--- |
| 134 | +---In some cases, wezterm may not know how to represent a key event in either its phys: or mapped: |
| 135 | +---forms. In that case, you may wish to define an assignment in terms of the underlying operating |
| 136 | +---system key code, using a `raw: prefix`. |
| 137 | +--- |
| 138 | +---Similar in concept to the `phys:` mapping described above, the `raw:` mapping is independent of |
| 139 | +---the OS keyboard layout. Raw codes are hardware and windowing system dependent, so there is no |
| 140 | +---portable way to list which key does what. |
| 141 | +--- |
| 142 | +---To discover these values, you can set `debug_key_events = true` and press the keys of interest. |
| 143 | +--- |
| 144 | +---You can specify a raw key value of 123 by using `key="raw:123"` in your config rather than one of |
| 145 | +---the other key values. |
| 146 | +--- |
147 | 147 | ---@field key string |
148 | | --- Possible Modifier labels are: |
149 | | --- |
150 | | --- `SUPER`, `CMD`, `WIN` - these are all equivalent: on macOS the Command key, on Windows the |
151 | | --- Windows key, on Linux this can also be the Super or Hyper key. Left and right are equivalent. |
152 | | --- |
153 | | --- `CTRL` - The control key. Left and right are equivalent. |
154 | | --- |
155 | | --- `SHIFT` - The shift key. Left and right are equivalent. |
156 | | --- |
157 | | --- `ALT`, `OPT`, `META` - these are all equivalent: on macOS the Option key, on other systems the |
158 | | --- Alt or Meta key. Left and right are equivalent. |
159 | | --- |
160 | | --- `LEADER` - a special modal modifier state managed by WezTerm. |
161 | | --- |
162 | | --- `VoidSymbol` - This keycode is emitted in special cases where the original function of the key has |
163 | | --- been removed. Such as in Linux and using setxkbmap: `setxkbmap -option caps:none`. The CapsLock |
164 | | --- will no longer function as before in all applications, instead emitting `VoidSymbol`. |
165 | | - |
166 | | --- You can also combine modifiers using the `|` symbol, like `"CMD|CTRL"`. |
167 | | --- |
| 148 | +---Possible Modifier labels are: |
| 149 | +--- |
| 150 | +---`SUPER`, `CMD`, `WIN` - these are all equivalent: on macOS the Command key, on Windows the |
| 151 | +---Windows key, on Linux this can also be the Super or Hyper key. Left and right are equivalent. |
| 152 | +--- |
| 153 | +---`CTRL` - The control key. Left and right are equivalent. |
| 154 | +--- |
| 155 | +---`SHIFT` - The shift key. Left and right are equivalent. |
| 156 | +--- |
| 157 | +---`ALT`, `OPT`, `META` - these are all equivalent: on macOS the Option key, on other systems the |
| 158 | +---Alt or Meta key. Left and right are equivalent. |
| 159 | +--- |
| 160 | +---`LEADER` - a special modal modifier state managed by WezTerm. |
| 161 | +--- |
| 162 | +---`VoidSymbol` - This keycode is emitted in special cases where the original function of the key has |
| 163 | +---been removed. Such as in Linux and using setxkbmap: `setxkbmap -option caps:none`. The CapsLock |
| 164 | +---will no longer function as before in all applications, instead emitting `VoidSymbol`. |
| 165 | +---You can also combine modifiers using the `|` symbol, like `"CMD|CTRL"`. |
| 166 | +--- |
168 | 167 | ---@field mods? string Optional modifiers keys. |
169 | 168 |
|
170 | 169 | ---@class Key :KeyNoAction |
171 | 170 | ---@field action KeyAssignment |
172 | 171 |
|
173 | 172 | ---@alias KeyAssignFunction fun(param: any): KeyAssignment |
174 | 173 |
|
175 | | --- Can also be called as function like older versions of wezterm did |
| 174 | +---Can also be called as function like older versions of wezterm did |
176 | 175 | ---@class ActionFuncClass |
177 | 176 | ---@field ActivateCommandPalette KeyAssignFunction |
178 | 177 | ---@field ActivateCopyMode KeyAssignFunction |
|
337 | 336 | ---@field ToggleFullScreen any |
338 | 337 | ---@field TogglePaneZoomState any |
339 | 338 |
|
340 | | --- Helper for defining key assignment actions in your configuration file. |
341 | | --- This is really just sugar for the underlying Lua -> Rust deserialation mapping |
342 | | --- that makes it a bit easier to identify where syntax errors may exist |
343 | | --- in your configuration file |
| 339 | +---Helper for defining key assignment actions in your configuration file. |
| 340 | +---This is really just sugar for the underlying Lua -> Rust deserialation mapping |
| 341 | +---that makes it a bit easier to identify where syntax errors may exist |
| 342 | +---in your configuration file |
344 | 343 | ---@alias Action ActionFuncClass|fun(action: ActionClass) |
0 commit comments