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

[Feature] Send a dummy keycode to neutralize flashing modifiers in retro tap and key overrides #20992

Merged
merged 5 commits into from
Jul 7, 2023

Conversation

precondition
Copy link
Contributor

@precondition precondition commented May 19, 2023

Description

Certain QMK features like Retro Tap and Key Overrides must unregister a previously registered modifier before sending a certain keycode but in doing so, the OS can sometimes misinterpret the intent of the user and trigger a keyboard shortcut when seeing the tap of modifier key. Notable examples are taps of the GUI key opening the start/applications menu in many desktop environments like Windows or Gnome or taps of the left Alt key focusing the menu bar in many GUI applications. This causes problems for the users of these features as described in issue #16795.

This PR aims to solve this issue by the neutralization of those flashing modifiers achieved through the tap of a dummy, user-configurable, keycode.

To illustrate; the idea is to send a keycode like Right Control so that the OS sees the following key events when retro-tapping LGUI_T(KC_A):

Left GUI down
Right Control down
Right Control up
Left GUI up
A down
A up

LGUI + RCtrl is an extremely rare keyboard shortcut which is unlikely to be bound to any action, so doing so amounts to a no-op and we can thus simply send "a" with no other side-effects, just as the user intended.

All the user has to do is to define two options in config.h:

#define DUMMY_MOD_NEUTRALIZER_KEYCODE <kc>
#define MODS_TO_NEUTRALIZE { <mod_mask_1>, <mod_mask_2> }

with sensible defaults for MODS_TO_NEUTRALIZE already available.

Types of Changes

  • Core
  • Bugfix
  • New feature
  • Enhancement/optimization
  • Keyboard (addition or update)
  • Keymap/layout/userspace (addition or update)
  • Documentation

Issues Fixed or Closed by This PR

Checklist

  • My code follows the code style of this project: C, Python
  • I have read the PR Checklist document and have made the appropriate changes.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • I have tested the changes and verified that they work and don't break anything (as well as I can manage).

@precondition
Copy link
Contributor Author

I am open to other naming suggestions

@precondition precondition force-pushed the anti_mod_flash branch 2 times, most recently from c7a5cd6 to 1704936 Compare May 19, 2023 21:24
@drashna drashna requested a review from a team June 11, 2023 05:48
@tzarc tzarc merged commit 1abf8f3 into qmk:develop Jul 7, 2023
@precondition precondition deleted the anti_mod_flash branch July 7, 2023 18:16
jesperhellberg pushed a commit to jesperhellberg/qmk_firmware that referenced this pull request Sep 9, 2023
thismarvin pushed a commit to thismarvin/qmk_firmware that referenced this pull request Sep 27, 2023
akeep pushed a commit to akeep/qmk_firmware that referenced this pull request Oct 2, 2023
csolje pushed a commit to csolje/qmk_firmware that referenced this pull request Oct 21, 2023
autoferrit pushed a commit to SpaceRockMedia/bastardkb-qmk that referenced this pull request Dec 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants