Skip to content
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

[REQUEST] Ability to trigger keybinding action on release of non-modifier keys of the combination #1720

Open
2 tasks done
antoine-hnkx opened this issue Oct 6, 2022 · 1 comment
Assignees
Labels
Feature Request libnkutils Needs work in libnkutils

Comments

@antoine-hnkx
Copy link

Before opening a feature request

  • I checked the next branch to see if the feature has already been implemented
  • I searched existing reports to see if it is already requested.

What is the user problem or growth opportunity you want to see solved?

I would like to use keybindings that trigger with the release of all non-modifier keys in the combination of keys.

For example, I would like to use this keybinding: "Control+!MousePrimary", which is composed of 1 modifier key (Control) & 1 non-modifier key (MousePrimary).
This would be equal to this timeline of events:
Control ↓ + MousePrimary ↓ + MousePrimary ↑ (TRIGGER KEYBINDING) + Control ↑

At the moment, afaik, it is only possible to add the release character ! at the start of the keybinding, as in this example: "!Control+MousePrimary" which results in this timeline of events:
Control ↓ + MousePrimary ↓ + MousePrimary ↑ + Control ↑ (TRIGGER KEYBINDING)
where all of the keys have to be released before triggering the keybinding.

I was thinking this could be achieved in 2 ways:

  1. By keeping the existing syntax of "!Control+MousePrimary" and adding an option ignore-modifier-release (for example)
  2. By extending the existing syntax with support for the release character ! at other places than at the start of the keybinding. (example: "Control+!MousePrimary")

Examples for Solution 1:

  • !Control+MousePrimary with ignore-modifier-release: true; → Press down all keys & Trigger once MousePrimary is released.
  • !Control+Shift+space with ignore-modifier-release: true; → Press down all keys & Trigger once space is released.

Examples for Solution 2:

  • Control+Shift+!space with new syntax → Press down all keys & Trigger once space is released.
  • Shift+!Alt+MousePrimary with new syntax → Press down all keys & Trigger once Alt & MousePrimary are released.

Solution 1 is (potentially?) simpler but only enables the use case for ignoring modifier key releases when using ! whereas Solution 2 is more complicated because of the new syntax but enables more possibilities (see the second example of Solution 2 just above)

How do you know that this problem exists today? Why is this important?

This would enable a more granular way of creating keybindings when using the release event of a key, and thus enable the users to add keybindings that are better suited to their needs/preferences.

Best example is with Control + Left Click or other combinations of modifier keys & mouse buttons where I'm used to having the action trigger as soon as I release the mouse button even if I still hold the modifier key(s) down.

Who will benefit from it?

People who are used to having actions trigger as soon as all the 'non-modifier' keys (a-z,A-Z,0-9, etc.) are released, without taking into account 'modifier' keys (Ctrl, Shift, Alt, etc.)

Rofi version (rofi -v)

Version: 1.7.5

Configuration

N / A

Additional information

No response

@sardemff7
Copy link
Collaborator

Context: bindings handling is done by libnkutils as an effort to pool the not-so-trivial logic from projects I’ve been working on

Spoiler alert: it is very unlikely that I will add that feature any time soon

To implement this, it would require a fairly big rewrite of the logic, as currently the binding itself is not ordered and stored as an integer
Such a rewrite is more or less planed for when I’ll add support for sequences (so-called Emacs-style) bindings

Any way, don’t hold your breath please 🙂

@sardemff7 sardemff7 self-assigned this Oct 7, 2022
@sardemff7 sardemff7 added the libnkutils Needs work in libnkutils label Oct 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Request libnkutils Needs work in libnkutils
Projects
None yet
Development

No branches or pull requests

2 participants