-
Notifications
You must be signed in to change notification settings - Fork 123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
actions: Add support for multiple actions per level #487
Conversation
80c9844
to
34b9145
Compare
34b9145
to
6adac2d
Compare
This new feature can be of help for shortcuts-related issues, such as: “Switching layout temporarily while modifier is held”. For example, using: key <LCTL> {
symbols[1] = [ {Control_L, ISO_First_Group } ],
actions[1] = [ {SetMods(modifiers=Control,clearLocks), SetGroup(group=-4)}]
}; and setting keymap That said, modifying actions in symbols is not really practical. But We could, however, introduce “composite” actions, e.g. But in the end, I think we need a dedicated feature that:
This would only internal with no special syntax, but a specialized API. |
5d7c75d
to
4075c7a
Compare
Rebased and added exhaustive tests, that enabled to discover some memory issues. We now disallow mixing multiple modifiers or group actions, as it requires to update state handling. I may add it in this PR if it is easy enough, else will do in a further MR/release. macOS CI is becoming very slow and fails. Looks like some issues with packaging. I do not think we had a full xorg server installed there, but now it does. |
4075c7a
to
685138c
Compare
Rebased to fix macOS CI. |
49eb8f5
to
b1a4c7d
Compare
Rebased after merging #526. |
b1a4c7d
to
d0c49c8
Compare
d0c49c8
to
58c4149
Compare
58c4149
to
3877267
Compare
Rebased after merging #519. |
Do not allow `{ a }` when a single `a` suffices.
The current field `u` (short for “union”) is not very descriptive. Next commit will add multiple actions per level, so let’s rename the keysym field to `s` (short for “symmbols”).
This makes 1 keysym == 1 action holds also for multiple keysyms per level. The motivation of this new feature are: - Make multiple keysyms per level more intuitive. - Explore how to fix the issue with shortcuts in multi-layout settings (see the xkeyboard-config issue[^1]). The idea is to use e.g.: ```c key <LCTL> { symbols[1] = [ {Control_L, ISO_First_Group } ], actions[1] = [ {SetMods(modifiers=Control), SetGroup(group=-4) } ] }; ``` in order to switch temporarily to a reference layout in order to get the same shortcuts on every layout. When no action is specified, `interpret` statements are used to find an action corresponding for *each* keysym, as expected. For an interpretation matching Any keysym, we may get the same interpretation for multiple keysyms. This may result in unwanted duplicate actions. So set this interpretation only if no previous keysym was matched with this interpret at this level, else set the default interpretation. For now, at most one action of each following categories is allowed per level: - modifier actions: `SetMods`, `LatchMods`, `LockMods`; - group actions: `SetGroup`, `LatchGroup`, `LockGroup`. Some examples: - `SetMods` + `SetGroup`: ok - `SetMods` + `SetMods`: error - `SetMods` + `LockMods`: error - `SetMods` + `LockGroup`: ok [^1]: https://gitlab.freedesktop.org/xkeyboard-config/xkeyboard-config/-/issues/416
3877267
to
35aa91c
Compare
Rebased after merging #518. |
This makes 1 keysym == 1 action holds also for multiple keysyms per level.
The motivation of this new feature are:
Make multiple keysyms per level more intuitive.
Explore how to fix the issue with shortcuts in multi-layout settings (see the
xkeyboard-config
issue).The idea is to use e.g.:
in order to switch temporarily to a reference layout in order to get the same shortcuts on every layout.
See the
xkeyboard-config
MR “Add option shortcuts:qwerty”.This is quite a big change, because it breaks the design “1 action per level”.
This is WIP because there might be lots of corner cases.
I will try to break this into smaller commits, although the nature of the change makes it difficult to have smaller commits that compile.
Fixes #486
TODO: