Skip to content

Keep Ctrl+Space for tmux and herdr after Korean input setup - #1

Closed
seunghan91 wants to merge 2 commits into
MoerAI:korean-input-setupfrom
seunghan91:korean-input-triggers
Closed

seunghan91 wants to merge 2 commits into
MoerAI:korean-input-setupfrom
seunghan91:korean-input-triggers

Conversation

@seunghan91

@seunghan91 seunghan91 commented Oct 6, 2026 •

Copy link
Copy Markdown

Follow-up to my comment on omacom#11719: two commits on top of korean-input-setup that address the shortcut conflicts, so setup leaves nothing to fix by hand.

  • Ctrl+Space stays the tmux/herdr prefix. Before restarting fcitx5, setup rewrites [Hotkey/TriggerKeys] in ~/.config/fcitx5/config: it drops every Ctrl+Space spelling fcitx5 accepts (Control+space, CTRL_SPACE, Control+SPACE, quoted or not) and makes sure Hangul and Shift+space are there. Those are the keys ibus-hangul uses, so keyboards without a 한/영 key still have a toggle. Other trigger keys and every other setting stay. With no trigger list configured, it starts from fcitx5's built-in one, so Zenkaku_Hankaku keeps working; a bare TriggerKeys= stays an empty list. The file is read the way fcitx5's INI parser reads it (trimmed lines, CRLF, quoted values, repeated sections merged by index), and the trigger list is written back as one section at the end.
  • F9 is no longer advertised for Hanja, since default/hypr/bindings/voxtype.lua binds it for dictation. The message and manual point to the 한자 key.
  • Success is checked. fcitx5 drops engine names it hasn't discovered without an error, so setup reads the group back and exits 1 with a hint instead of printing "Korean input is ready."

Tests: test/shell.d/input-korean-test.sh gains the trigger rewrite on a fresh config (keeping Zenkaku_Hankaku), a bare TriggerKeys=, a rerun, an existing config with other sections, a CRLF/duplicate-section/alias fixture, and the read-back failure. It passes on Arch with bash 5. ./test/all there shows the same failures as korean-input-setup itself, all environment-related (no node, updatedb or omarchy-pkgs checkout), and two more passing tests.

End to end, with the real script against fcitx5 5.1.23 and fcitx5-hangul 5.1.11 on a profile in its fresh-install state, driven through fcitx5's D-Bus input context:

  • Ctrl+Space is no longer handled by fcitx5, so it reaches the app.
  • Shift+Space, the Hangul keysym and Zenkaku_Hankaku each toggle keyboard-us ↔ hangul.
  • gksrmf → 한글, dkssud → 안녕.
  • The config survives fcitx5 exiting and restarting.

Through a real compositor as well: headless sway 1.12 → fcitx5 over input-method-v2 → foot → tmux with Omarchy's C-Space prefix, keys sent with wtype, and Ctrl+Space, c as the probe (tmux opens a second window when it gets the prefix):

Profile and triggers tmux windows after Ctrl+Space, c Input method after it gksrmf␣ after Shift+Space
English only (fresh install) 2: prefix reached tmux keyboard-us gksrmf
keyboard-us + hangul, fcitx5 default triggers (this PR as-is) 1: fcitx5 took it hangul, and the c was typed as ㅊ 한글
keyboard-us + hangul, triggers from this commit 2: prefix reached tmux keyboard-us 한글

So without the trigger change, setting up Korean takes the tmux/herdr prefix away; with it, both work. sway stands in for Hyprland here (Hyprland 0.56 has no headless backend). A physical Korean keyboard is still on my list.

Written and tested with help from Claude (an Anthropic AI model).

fcitx5 switches input methods on Ctrl+Space by default, which is also
Omarchy's tmux and herdr prefix. Once hangul joins the group, fcitx5
takes the chord first. Setup now drops every Ctrl+Space spelling from
[Hotkey/TriggerKeys] and switches with the 한/영 key (Hangul) or
Shift+Space, the keys ibus-hangul uses, keeping other trigger keys and
settings.

F9 is the voxtype dictation key, so Hanja is pointed at the 한자 key
only. fcitx5 drops undiscovered engine names without an error, so the
group is read back before setup reports success.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_019giKJAi15aAheoMjWCsizr
Without a [Hotkey/TriggerKeys] section fcitx5 uses its built-in list,
Control+space, Zenkaku_Hankaku and Hangul. Start from that list so only
Ctrl+Space goes and the 全角/半角 key keeps switching. A bare
TriggerKeys= under [Hotkey] is an explicit empty list and stays one.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_019giKJAi15aAheoMjWCsizr

@MoerAI MoerAI left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this. Reviewed at db59104 against its base 5356386, and separately against current quattro (8a787b6).

Within its own scope the change holds up. An independent P0-P2 review found no actionable defect, and I reproduced the fix directly rather than trusting the tests: run against the base script, an existing [Hotkey/TriggerKeys] of Control+space, Super+space, Hangul came back unchanged; run against this branch, the same config became Super+space, Hangul, Shift+space with [Hotkey] and [Behavior] settings intact, a missing config became Zenkaku_Hankaku, Hangul, Shift+space, and a bare TriggerKeys= became Hangul, Shift+space. Every rerun left the file byte-identical. test/shell.d/input-korean-test.sh and test/cli were green, 117 assertions.

I am not merging it because it has been overtaken upstream, not because it is wrong:

  • Its base PR omacom#11719 was closed unmerged on 2026-10-15 in favour of omacom#15508 ("Perfect Japanese, Chinese and Korean setups"), which merged into quattro the same day. Merging this into korean-input-setup would land in a branch that no longer has an upstream destination.
  • Both problems it fixes are already fixed on quattro, by a different mechanism. Omarchy now ships config/fcitx5/config whose [Hotkey/TriggerKeys] is Zenkaku_Hankaku and Hangul, under the comment "Omarchy binds Super+I. Leave Ctrl+Space to tmux/Herdr and other Super keys to the desktop." - so Ctrl+Space never becomes a trigger key in the first place. The manual now states that Ctrl + Space stays available for Tmux and Herdr and that dictation push-to-talk stays on F9, so F9 is no longer advertised for Hanja either.
  • The files this PR edits are gone or rewritten upstream: bin/omarchy-setup-input-hangul was replaced by the generic bin/omarchy-setup-input plus default/input-methods/presets.json and typing_setup.py, test/shell.d/input-korean-test.sh by typing-setup-checks.py and input-method-checks.py, and manual/34-keyboard-mouse-trackpad.md was rewritten.
  • Your Right Alt and 한자 point did land: omacom#15508 credits you as co-author and uses XKB kr(kr104), and the manual documents 한/영 and 한자 working "whether your keyboard has dedicated keys or sends Right Alt and Right Ctrl". The kb_options string from this branch was not used because quattro had already removed that option.

So I plan to close this as superseded. If you think something here is still not covered on current quattro - a case the shipped defaults miss - say so and I will take that part upstream instead.

Proof limits, so this review is not read as more than it is: the above is CLI and config-file evidence from a disposable Linux container with a throwaway $HOME and stubbed package, service and D-Bus boundaries, plus upstream source read at quattro 8a787b6. I did not run native fcitx5, a compositor, a physical Korean keyboard, Hanja conversion, or the full ./test/all. Your own sway, foot and tmux results remain your evidence, not mine.

# Shift+Space, the same keys ibus-hangul uses. Other trigger keys and settings
# stay; the trigger list is rewritten as one section at the end of the file.
# fcitx5 reads this file when it starts, which the restart below takes care of.
fcitx5_config="$HOME/.config/fcitx5/config"

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[note] This is the one durable design difference, and upstream has now settled it the other way.

This block rewrites a user-owned file: it drops every Ctrl+Space spelling, normalises quoting and CRLF, and re-emits [Hotkey/TriggerKeys] as a single section moved to the end of ~/.config/fcitx5/config. quattro reaches the same end state by shipping config/fcitx5/config with Ctrl+Space absent from [Hotkey/TriggerKeys] and leaving the user's own file alone; its setup command even reports that existing custom Fcitx keys are preserved.

The AWK parsing itself matched fcitx5's INI reader in my runs - trimmed lines, CRLF, quoted values, repeated sections merged by index, and a bare TriggerKeys= treated as an explicit empty list. So this is about where the setting belongs, not about the parser.

@seunghan91

Copy link
Copy Markdown
Author

Agreed, this is superseded by omacom#15508: the shipped Fcitx defaults keep Ctrl+Space out of the trigger keys without touching the user's file, and the F9 hint is gone. Thanks for the careful review and for checking the parser behaviour. Closing.

@seunghan91 seunghan91 closed this Oct 17, 2026
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

Successfully merging this pull request may close these issues.

2 participants