-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Clarify how multiple assignments to same keymap work
- Loading branch information
Showing
1 changed file
with
6 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,17 +12,22 @@ New keybindings are created by binding a [command](commands.md) identifier to a | |
```csharp | ||
Check failure on line 12 in docs/docs/customize/keybinds.md
|
||
context.KeybindManager.SetKeybind("whim.core.cycle_layout_engine.next", new Keybind(KeyModifiers.LAlt, VIRTUAL_KEY.VK_SPACE)); | ||
``` | ||
|
||
Keybinds have a `Modifiers` and `Key` property. The available modifiers and keys can be found in the <xref:Whim.KeyModifiers> and <xref:Windows.Win32.UI.Input.KeyboardAndMouse.VIRTUAL_KEY> enums. Modifiers can be combined using the bitwise OR operator. For instance, the following creates a new <kbd>Alt</kbd> + <kbd>Shift</kbd> modifier, which can be used to create Keybinds: | ||
|
||
```csharp | ||
KeyModifiers AltShift = KeyModifiers.LAlt | KeyModifiers.LShift; | ||
``` | ||
Check failure on line 20 in docs/docs/customize/keybinds.md
|
||
A number of common modifiers combinations is also accessible from the <xref:Whim.IKeybind> interface. | ||
Check failure on line 21 in docs/docs/customize/keybinds.md
|
||
|
||
To treat key modifiers like `LWin` and `RWin` the same, see <xref:Whim.IKeybindManager.UnifyKeyModifiers>. | ||
|
||
> [ !NOTE] | ||
> Each _command_ can only be bound to a single keybind -- subsequent bindings to the same command will overwrite earlier ones. However, each _keybind_ can be assigned to multiple commands. If more than one command is triggered to a keymap, they will be triggered in the order of their assignment. | ||
## Overwriting Keybinds | ||
|
||
Each command can only be bound to a single keybind. Hence, any default binding can be overwritten by rebinding the corresponding command as described above. | ||
Default bindings can be overwritten by simply rebinding the corresponding _command_ as described above. | ||
|
||
> [!WARNING] | ||
> When overriding keybinds for plugins, make sure to set the keybind **after** calling `context.PluginManager.AddPlugin(plugin)`. | ||
|