From 8e3f12aa19032ec3ceb13139f42b89bf2b028c97 Mon Sep 17 00:00:00 2001 From: Ryan Yin Date: Mon, 5 Oct 2026 22:41:48 +0800 Subject: [PATCH] feat(vinput): open the command palette with right Ctrl Pin keyd's right-hand modifiers (rightcontrol/rightshift/rightmeta) to their own keycodes; keyd otherwise folds them into the left keys. Set Vinput's MenuKey to right Ctrl and clear CommandKeys, which would shadow it. --- WORKAROUNDS.md | 1 + home/linux/gui/base/vinput/README.md | 15 ++++++++++++--- home/linux/gui/base/vinput/default.nix | 11 +++++++++-- modules/nixos/desktop/peripherals.nix | 11 +++++++++++ 4 files changed, 33 insertions(+), 5 deletions(-) diff --git a/WORKAROUNDS.md b/WORKAROUNDS.md index e1c38fac..ba11380f 100644 --- a/WORKAROUNDS.md +++ b/WORKAROUNDS.md @@ -36,6 +36,7 @@ A setting that works around a bug or a hardware quirk. | WA-009 | USB-SATA bridge mitigations (`usbcore.autosuspend=-1`, `usb-storage.delay_use=10`) — `hosts/12kingdoms-youko/default.nix` | flaky JMicron JMS567 resets with UDMA-CRC and I/O errors | Drop once the bridge/controller is replaced; the signal is smartctl CRC/media errors | 2026-09-21 | on hardware change or CRC errors | active | | WA-010 | Insta360 Link USB reset on S3 resume — `hosts/idols-ai/default.nix` | the camera stays enumerated with a stalled UVC endpoint after resume | Drop after the Insta360 firmware or the kernel `uvcvideo` fixes it | 2026-08-01 | on kernel or firmware change | active | | WA-011 | Kernel module blacklist (`esp4`, `esp6`, `rxrpc`) — `hardening/kernel-hardening.nix` | attack surface for the Dirty Frag LPE (CVE-2026-43284 / CVE-2026-43500) | Kept as defence in depth; drop only if something needs those modules | 2026-10-03 | rarely | active | +| WA-017 | keyd right-hand modifier passthrough — `modules/nixos/desktop/peripherals.nix` | keyd folds right Ctrl/Shift/Meta into their left keys | Drop once keyd or fcitx5 keeps right-hand modifiers distinct | 2026-10-05 | on keyd bump | active | If WA-008 freezes recur, the fallback is to restore `nvme_core.default_ps_max_latency_us=0 nvme_core.io_timeout=4294967295 pcie_aspm=off`; this is a diff --git a/home/linux/gui/base/vinput/README.md b/home/linux/gui/base/vinput/README.md index 07164606..7e3d27f9 100644 --- a/home/linux/gui/base/vinput/README.md +++ b/home/linux/gui/base/vinput/README.md @@ -1,8 +1,17 @@ # Fcitx5 Vinput -On `ai` and `shoukei`, install a Sherpa-ONNX model, then hold and release **right Alt** to dictate. -**Right Shift** toggles Chinese/English; **left Shift** remains a normal modifier. Open Vinput from -the application launcher for settings. +Voice input on `ai` and `shoukei`, backed by a Sherpa-ONNX model. Open Vinput from the application +launcher for settings. + +## Key bindings + +- Right Alt: record. Hold and release to dictate. +- Right Ctrl: open the command palette (`/model /asr /scene /proc`). + +Vinput resolves `TriggerKey` > `CommandKeys` > `MenuKey`. `TriggerKey` is right Alt by default; the +config sets `MenuKey` to right Ctrl and clears `CommandKeys`, which otherwise defaults to right Ctrl +and would shadow `MenuKey`. The addon reads list options as `[Option]` plus `0=`, not the +`[Trigger]` shorthand in upstream's `vinput-config(5)` man page. ## One-time setup (CLI) diff --git a/home/linux/gui/base/vinput/default.nix b/home/linux/gui/base/vinput/default.nix index 5634b087..f2fc7ccb 100644 --- a/home/linux/gui/base/vinput/default.nix +++ b/home/linux/gui/base/vinput/default.nix @@ -15,11 +15,18 @@ in config = lib.mkIf cfg.enable { i18n.inputMethod.fcitx5.addons = [ vinput ]; + # MenuKey opens the command palette; set it to right Ctrl. `CommandKeys` + # (voice command on the selection) defaults to right Ctrl and outranks + # `MenuKey`, so clear it or the palette never opens. List options use + # fcitx5's `[Option]` + `0=` form, not upstream's `[Trigger]` shorthand. xdg.configFile."fcitx5/conf/vinput.conf" = { text = '' - [Trigger] - MenuKey=Super_R + [MenuKey] + 0=Control_R + + [CommandKeys] ''; + # fcitx5 rewrites this file at runtime, like `profile` and `config`. force = true; }; diff --git a/modules/nixos/desktop/peripherals.nix b/modules/nixos/desktop/peripherals.nix index a22ab6f5..d250c809 100644 --- a/modules/nixos/desktop/peripherals.nix +++ b/modules/nixos/desktop/peripherals.nix @@ -64,6 +64,17 @@ # overloads the capslock key to function as both escape (when tapped) and control (when held) capslock = "overload(control, esc)"; esc = "capslock"; + + # keyd rewrites right-hand modifiers as their left counterparts, so + # pin them to their own keycodes. Vinput's MenuKey is right Ctrl and + # Rime's right Shift switches CN/EN. + rightcontrol = "rightcontrol"; + rightshift = "rightshift"; + rightmeta = "rightmeta"; + + # Right Alt is AltGr, the third-level shift on many European layouts + # (e.g. `AltGr+2` is `@` in Spanish); keyd forwards it as-is. + rightalt = "layer(altgr)"; }; }; };