Skip to content

Makes Key Lock accessible from code enabling Locking Modifiers #22206#26330

Open
brotheramai wants to merge 1 commit into
qmk:developfrom
brotheramai:key_lock_util
Open

Makes Key Lock accessible from code enabling Locking Modifiers #22206#26330
brotheramai wants to merge 1 commit into
qmk:developfrom
brotheramai:key_lock_util

Conversation

@brotheramai

Copy link
Copy Markdown

Description

Adds begin_key_lock() which mimics pressing QK_LOCK since tap_code does not accept QK_LOCK and tap_code16 exhibits strange behavior when QK_LOCK is passed (on my machine it types 11).
Adds get_key_lock_begun() which returns whether Key Lock is watching for a key to be locked.
Adds get_key_lock_state() which can be passed a keycode and returns its current lock state.

These combined allow for keymap code that can interact with Key Lock to, for example, make specific modifiers toggle like CAPS LOCK when pressed. See examples section of doc for specifics.

Types of Changes

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

Issues Fixed or Closed by This PR

These are all already closed, but would be at least partially addressed 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).

@zvecr zvecr changed the base branch from master to develop July 14, 2026 03:27
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.

1 participant