Show the input switching shortcut in keyboard hints

This commit is contained in:
David Heinemeier Hansson committed 2026-10-07 18:10:20 +02:00
1 parent f273eed840
commit ee358c251b
4 files changed
+7 -2

No files matched your search

+2 -1
View File
@@ -332,6 +332,7 @@ dynamic_bindings() {
static_bindings() { static_bindings() {
echo "SHIFT ALT,L,Copy URL from Web App,sendshortcut,SHIFT ALT,L," echo "SHIFT ALT,L,Copy URL from Web App,sendshortcut,SHIFT ALT,L,"
echo "SHIFT ALT,D,Download Video from Web App,sendshortcut,SHIFT ALT,D," echo "SHIFT ALT,D,Download Video from Web App,sendshortcut,SHIFT ALT,D,"
echo "CTRL SHIFT,SPACE,Switch input language,exec,fcitx5-remote -t"
} }
# Actions Omarchy binds to a second chord meant as an alternative, named one at # Actions Omarchy binds to a second chord meant as an alternative, named one at
@@ -533,7 +534,7 @@ output_binding_records_uncached() {
keybindings_cache_key() { keybindings_cache_key() {
{ {
printf 'v14\n' printf 'v15\n'
hyprctl devices 2>/dev/null | grep -F 'active keymap:' hyprctl devices 2>/dev/null | grep -F 'active keymap:'
hyprctl binds 2>/dev/null hyprctl binds 2>/dev/null
} | sha256sum | awk '{ print $1 }' } | sha256sum | awk '{ print $1 }'
@@ -120,7 +120,7 @@ function inputLabel(state, fallback) {
function inputTooltip(state, layout, multipleLayouts) { function inputTooltip(state, layout, multipleLayouts) {
if (!state || !state.methods || state.methods.length < 2) if (!state || !state.methods || state.methods.length < 2)
return layout + (multipleLayouts ? "" : "\nClick to set up an input language") return layout + (multipleLayouts ? "" : "\nClick to set up an input language")
var text = state.name + "\nClick to switch input language" var text = state.name + "\nClick to switch input language\nCtrl + Shift + Space to toggle input"
if (state.methods.indexOf("mozc") !== -1) if (state.methods.indexOf("mozc") !== -1)
text += "\nJapanese: type a word, then Space twice for character choices" text += "\nJapanese: type a word, then Space twice for character choices"
if (multipleLayouts) text += "\nRight-click to switch keyboard layout" if (multipleLayouts) text += "\nRight-click to switch keyboard layout"
+3
View File
@@ -64,6 +64,9 @@ rendered=$(keybindings)
grep -q 'SUPER + F *→ Full screen' <<<"$rendered" || grep -q 'SUPER + F *→ Full screen' <<<"$rendered" ||
fail "a chord with no alternative renders on its own" "$rendered" fail "a chord with no alternative renders on its own" "$rendered"
pass "the keybindings menu renders its entries" pass "the keybindings menu renders its entries"
grep -q 'CTRL SHIFT + SPACE *→ Switch input language' <<<"$rendered" ||
fail "the input switch shortcut appears in the cheatsheet" "$rendered"
pass "the input switch shortcut appears in the cheatsheet"
(( $(grep -c '→ Close window$' <<<"$rendered") == 1 )) || (( $(grep -c '→ Close window$' <<<"$rendered") == 1 )) ||
fail "an alternative chord joins the row of the first one" "$rendered" fail "an alternative chord joins the row of the first one" "$rendered"
+1
View File
@@ -15,6 +15,7 @@ assertEqual(model.inputLabel({}, 'EN'), 'EN', 'a stopped input service retains t
assertEqual(model.inputLabel({ current: 'hangul' }, 'EN'), '한', 'Korean input has a distinct label') assertEqual(model.inputLabel({ current: 'hangul' }, 'EN'), '한', 'Korean input has a distinct label')
assertEqual(model.inputLabel({ current: 'custom', language: 'vi' }, 'EN'), 'VI', 'other engines use their reported language') assertEqual(model.inputLabel({ current: 'custom', language: 'vi' }, 'EN'), 'VI', 'other engines use their reported language')
assertEqual(model.inputTooltip(japanese, 'English (US)', false).includes('Space twice'), true, 'Japanese explains character choices') assertEqual(model.inputTooltip(japanese, 'English (US)', false).includes('Space twice'), true, 'Japanese explains character choices')
assertEqual(model.inputTooltip(japanese, 'English (US)', false).includes('Ctrl + Shift + Space'), true, 'the input toggle shortcut is discoverable')
assertEqual(model.inputTooltip(japanese, 'English (US)', true).includes('Right-click'), true, 'combined input and layout switching stays discoverable') assertEqual(model.inputTooltip(japanese, 'English (US)', true).includes('Right-click'), true, 'combined input and layout switching stays discoverable')
assertEqual(model.inputTooltip({ methods: ['keyboard-fr'] }, 'French', false), 'French\nClick to set up an input language', 'one foreign mode offers input setup') assertEqual(model.inputTooltip({ methods: ['keyboard-fr'] }, 'French', false), 'French\nClick to set up an input language', 'one foreign mode offers input setup')
assertEqual(model.showIndicator('EN', false, false), false, 'English alone stays hidden') assertEqual(model.showIndicator('EN', false, false), false, 'English alone stays hidden')