You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The hotkey syntax is convenient, but has the disadvantage that it is difficult to do programmable operations such as turning off specific hotkeys.
This can be solved by creating a class that abstracts the hotkey.
This would also allow us to set up hotkeys using external files such as json files, for example.
However, there are still some inconveniences.
Since I am using hotkeys to change the keyboard layout, I may want to temporarily turn off those hotkeys when playing a single player game.
So I will solve this problem by grouping those hotkeys and providing a way to control them all at once.
The next thing to think about is the actions of the hotkeys.
In most cases, the Send function and user-defined functions are sufficient, but it would be useful to be able to assign more related actions with a single hotkey definition.
The following three advanced actions are the ones I have actually implemented and found useful.
In addition to the defined hotkeys, the action can be switched by pressing modifier keys (Shift, Ctrl, etc.) at the same time. This is useful if you are using combination keys such as a & b.
Switch actions based on how many times a non-modifier key of a defined hotkey is pressed within a specified time.
Switch between actions by additionally keying after the defined hotkey. Optionally, a tooltip can be used to indicate which key press will trigger which action or not.
Searchable and selectable actions, similar to VSCode's command palette. For example, you can open a specific project by VSCode from a list of projects. The interface can be implemented with tooltips or Gui
These were enough to solve my frustration, but may not be enough to solve the frustration of others.
; 2.0-beta.1
hotkeys := bee.HotkeyGroup()
; Add hotkey
hotkeys.add(bee.Hotkey("+!a", "{Shift Down}abc{Shift Up}"))
; hotkeys.add("+!a", "{Shift Down}abc{Shift Up}") ; shorthund
hotkeys.add("+!b", () => Something())
; Assign the same action
hotkeys.add([ "+!c", "+!d" ], () => Something())
; Defining hotkeys using objects and maps
hotkeys.add({
%"+!e"%: () => Something()
})
hotkeys.add(Map(
"+!e", () => Something()
))
; If you omit the second argument, you can define a hotkey that does nothing. This is useful for disabling unwanted shortcut keys in Windows.
hotkeys.add([ "+!e", "+!f"])
; Register all hotkeys. The HotkeyGroup will not do anything until this is called.
hotkeys.register()
The text was updated successfully, but these errors were encountered:
The hotkey syntax is convenient, but has the disadvantage that it is difficult to do programmable operations such as turning off specific hotkeys.
This can be solved by creating a class that abstracts the hotkey.
This would also allow us to set up hotkeys using external files such as json files, for example.
However, there are still some inconveniences.
Since I am using hotkeys to change the keyboard layout, I may want to temporarily turn off those hotkeys when playing a single player game.
So I will solve this problem by grouping those hotkeys and providing a way to control them all at once.
The next thing to think about is the actions of the hotkeys.
In most cases, the Send function and user-defined functions are sufficient, but it would be useful to be able to assign more related actions with a single hotkey definition.
The following three advanced actions are the ones I have actually implemented and found useful.
a & b
.These were enough to solve my frustration, but may not be enough to solve the frustration of others.
If you have any ideas, please comment.
bee.Hotkey's interface
bee.HotkeyGroup's interface
Example of use.
The text was updated successfully, but these errors were encountered: