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

Remap modifiers when released only (keeping its function untouched) #287

Closed
jose1711 opened this issue Feb 6, 2022 · 6 comments
Closed

Comments

@jose1711
Copy link
Contributor

jose1711 commented Feb 6, 2022

Currently I find it impossible to map a modifier - e. g. Left Alt to a key if it's the only key pressed while keeping its original function (modifier) when combined with other keys.
Goal:

  • Left alt is "space" when pressed and released alone
  • Left alt + F2 still brings up execute dialog (in Gnome)

Configuration:
obrázok

Result:

  • Left alt -> space works
  • Left + anything else - breaks
@jonasBoss
Copy link
Collaborator

It should work with if_single(KEY_SPACE, LEFT_ALT)
https://github.com/sezanzeb/input-remapper/blob/main/readme/macros.md#if_single

@jose1711
Copy link
Contributor Author

jose1711 commented Feb 6, 2022

if_single(key(KEY_SPACE), key(KEY_LEFTALT))

Thank you, this works but only to an extent. In Gnome Alt-held, Tab-tapped, Alt-still held no longer brings the menu with active windows. "Alt-tabbing" between most recent windows still works though.

@sezanzeb
Copy link
Owner

sezanzeb commented Feb 6, 2022

if_single(key(KEY_SPACE), hold(KEY_LEFTALT)) might work then

@jose1711
Copy link
Contributor Author

jose1711 commented Feb 6, 2022

if_single(key(KEY_SPACE), hold(KEY_LEFTALT))

Thank you, that worked nicely. What if I want to map Control L + Alt L but only if pressed alone? if_single does not seem to be able to capture such events - it works for a single modifier, but not multiple ones.

@sezanzeb
Copy link
Owner

sezanzeb commented Feb 6, 2022

The issue is probably that while Control_L is pressed, all of the injected events are consumed by the environment to potentially trigger shortcuts. Like ctrl + a to select all.

Try mapping Control L to Control L, and add key(Control_L)... to your mapping. like:

image

image

This is a bit stupid as of now. In the future there will probably a key_up macro that properly releases the Control_L key (depending on which uinput has it pressed at the moment) before going into the macro.

The redundant control_l macro is needed at the moment to ensure the control event is sent to the "keyboard" uinput, so that the key macro can release it.

Also see https://github.com/sezanzeb/input-remapper/blob/main/readme/usage.md#combinations

@jose1711
Copy link
Contributor Author

jose1711 commented Feb 8, 2022

Thank you, it's a bit complex but I works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants