rofi icon indicating copy to clipboard operation
rofi copied to clipboard

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

Open antoine-hnkx opened this issue 2 years ago • 1 comments

Before opening a feature request

  • [X] I checked the next branch to see if the feature has already been implemented
  • [X] 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

antoine-hnkx avatar Oct 06 '22 18:10 antoine-hnkx

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 :slightly_smiling_face:

sardemff7 avatar Oct 07 '22 07:10 sardemff7