Universal clipboard: one tap per press, with its own filter instead of k2k #27

Merged
arne merged 2 commits from universal-clipboard-tap into main 2026-11-06 17:39:04 +01:00
Owner

Super+C / Super+V only worked some of the time. interception-k2k's multi rules hold their output down until every key in the chord is up, so while Super stayed held:

  • repeat pastes — Shift+Insert stayed down, and key repeat pasted again
  • Super+C → Super+V without letting go sent Ctrl+Shift+Insert, which pastes nothing
  • a second Super+V was swallowed
  • Super+V → Super+1 typed a "1", because Super had already been released downstream

nix/universal-clipboard/uc.c replaces k2k and both patches. It is a small filter written for this job:

  • each fresh press of C/V with Super held, and no Shift/Ctrl/Alt, becomes one complete tap of Ctrl/Shift+Insert
  • Super is released for the tap and pressed again just before the next key
  • the tapped key's repeats and release are swallowed

test.c covers each case above plus the pass-through ones (Mod+Shift+V, plain C/V). It runs in the derivation's checkPhase.

The clipboard now stands aside for Ctrl the way it already did for Shift, so Mod+Ctrl+C (center-visible-columns) is bound again.

Built into black's toplevel with --override-input. All 11 tests pass in the build log.

🤖 Generated with Claude Code

Super+C / Super+V only worked some of the time. interception-k2k's multi rules hold their output down until *every* key in the chord is up, so while Super stayed held: - **repeat pastes** — Shift+Insert stayed down, and key repeat pasted again - **Super+C → Super+V without letting go** sent Ctrl+Shift+Insert, which pastes nothing - **a second Super+V** was swallowed - **Super+V → Super+1** typed a "1", because Super had already been released downstream `nix/universal-clipboard/uc.c` replaces k2k and both patches. It is a small filter written for this job: - each fresh press of C/V with Super held, and no Shift/Ctrl/Alt, becomes one complete tap of Ctrl/Shift+Insert - Super is released for the tap and pressed again just before the next key - the tapped key's repeats and release are swallowed `test.c` covers each case above plus the pass-through ones (Mod+Shift+V, plain C/V). It runs in the derivation's checkPhase. The clipboard now stands aside for Ctrl the way it already did for Shift, so Mod+Ctrl+C (center-visible-columns) is bound again. Built into black's toplevel with `--override-input`. All 11 tests pass in the build log. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Super+C/V only worked some of the time. interception-k2k's multi rules hold
their output down until every key in the chord is up, so with Super still held:
Shift+Insert stayed down and key repeat pasted again; Super+C then Super+V sent
Ctrl+Shift+Insert, which pastes nothing; a second Super+V was swallowed; and
Super, already released downstream, turned Super+1 into a typed "1".

`uc` is now a small filter written for this job: each fresh press of C or V
with Super held (and no Shift, Ctrl or Alt) is one complete tap of
Ctrl/Shift+Insert, Super is released for the tap and pressed again before the
next key, and the tapped key's repeats and release are swallowed. A test of
each case runs at build time. The k2k source and both patches are gone.

Since the clipboard now stands aside for Ctrl as it does for Shift,
Mod+Ctrl+C (center-visible-columns) is bound again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
arne force-pushed universal-clipboard-tap from 61f157b684 to 105f540fa1 2026-11-06 17:03:14 +01:00 Compare
other_mods_held() counted MOD_KEY as "another modifier held", so with the
documented `modKey = "KEY_LEFTALT"` holding the clipboard key made the
clipboard stand aside and Super+C/V never fired. Skip MOD_KEY in that check,
and run the tests against KEY_LEFTALT as well as the configured key.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
arne merged commit 964c058b0e into main 2026-11-06 17:39:04 +01:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
bases/fjord!27
No description provided.