Localize dynamic bind templates and the Super+K matcher

Workspace, group-window, and bar-panel loops emit Chinese
descriptions; omarchy-menu-keybindings' merge list and priority
patterns follow them, so combined chords and curated ordering
survive localization. Affected tests updated.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QKxGW1raAWaqeU8WdHsMsp
This commit is contained in:
2026-08-25 11:09:05 -04:00
co-authored by Claude Fable 5
parent e673e63baa
commit 2eff2a37b3
6 changed files with 58 additions and 58 deletions
+47 -47
View File
@@ -338,10 +338,10 @@ static_bindings() {
# for interchangeably belong on one row. # for interchangeably belong on one row.
alternative_chord_actions() { alternative_chord_actions() {
cat <<'ACTIONS' cat <<'ACTIONS'
Close window 关闭窗口
Calculator 计算器
Toggle scratchpad 切换便签区
Move window to scratchpad 窗口移入便签区
ACTIONS ACTIONS
} }
@@ -442,58 +442,58 @@ prioritize_entries() {
sub(/ \/ [^→]*→/, " →", line) sub(/ \/ [^→]*→/, " →", line)
prio = 50 prio = 50
if (match(line, /Keybindings/)) prio = 0 if (match(line, /快捷键/)) prio = 0
if (match(line, /Omarchy menu/)) prio = 1 if (match(line, /Omarchy 菜单/)) prio = 1
if (match(line, /Terminal/)) prio = 2 if (match(line, /终端/)) prio = 2
if (match(line, /Browser/) && !match(line, /Browser[[:space:]]*\(/) && !match(line, /SUPER SHIFT.*\+.*B.*→.*Browser/)) prio = 3 if (match(line, /浏览器/) && !match(line, /浏览器(/) && !match(line, /SUPER SHIFT.*\+.*B.*→.*浏览器/)) prio = 3
if (match(line, /File manager/) && !match(line, /File manager \(cwd\)/)) prio = 4 if (match(line, /文件管理器/) && !match(line, /文件管理器(当前目录)/)) prio = 4
if (match(line, /Launch apps/)) prio = 5 if (match(line, /Launch apps/)) prio = 5
if (match(line, /System menu/)) prio = 6 if (match(line, /系统菜单/)) prio = 6
if (match(line, /Theme menu/)) prio = 7 if (match(line, /主题菜单/)) prio = 7
if (match(line, /Full screen/)) prio = 8 if (match(line, /全屏/)) prio = 8
if (match(line, /Full width/)) prio = 9 if (match(line, /全宽/)) prio = 9
if (match(line, /Close window/)) prio = 10 if (match(line, /关闭窗口/)) prio = 10
if (match(line, /Close all windows/)) prio = 11 if (match(line, /关闭所有窗口/)) prio = 11
if (match(line, /Lock system/)) prio = 12 if (match(line, /锁定系统/)) prio = 12
if (match(line, /Toggle window floating/)) prio = 13 if (match(line, /切换窗口浮动/)) prio = 13
if (match(line, /Toggle window split/)) prio = 14 if (match(line, /切换窗口分割/)) prio = 14
if (match(line, /Pop window/)) prio = 15 if (match(line, /弹出窗口/)) prio = 15
if (match(line, /Universal/)) prio = 16 if (match(line, /通用/)) prio = 16
if (match(line, /Clipboard/)) prio = 17 if (match(line, /剪贴板/)) prio = 17
if (match(line, /Audio controls/)) prio = 18 if (match(line, /Audio controls/)) prio = 18
if (match(line, /Bluetooth controls/)) prio = 19 if (match(line, /Bluetooth controls/)) prio = 19
if (match(line, /Wifi controls/)) prio = 20 if (match(line, /Wifi controls/)) prio = 20
if (match(line, /Emojis/)) prio = 21 if (match(line, /表情/)) prio = 21
if (match(line, /Color picker/)) prio = 22 if (match(line, /取色器/)) prio = 22
if (match(line, /Screenshot/)) prio = 23 if (match(line, /截图/)) prio = 23
if (match(line, /Screenrecording/)) prio = 24 if (match(line, /录屏/)) prio = 24
if (match(line, /Tmux/)) prio = 25 if (match(line, /Tmux/)) prio = 25
if (match(line, /Herdr/)) prio = 26 if (match(line, /Herdr/)) prio = 26
if (match(line, /SUPER SHIFT.*\+.*B.*→.*Browser/)) prio = 27 if (match(line, /SUPER SHIFT.*\+.*B.*→.*浏览器/)) prio = 27
if (match(line, /File manager \(cwd\)/)) prio = 28 if (match(line, /文件管理器(当前目录)/)) prio = 28
if (match(line, /(Switch|Next|Former|Previous).*workspace/)) prio = 29 if (match(line, /(切换到|下一|上一|上次)工作区/)) prio = 29
if (match(line, /Move window to workspace/)) prio = 30 if (match(line, /窗口移到工作区/)) prio = 30
if (match(line, /Move window silently to workspace/)) prio = 31 if (match(line, /窗口静默移到工作区/)) prio = 31
if (match(line, /Swap window/)) prio = 32 if (match(line, /互换/)) prio = 32
if (match(line, /Focus/)) prio = 33 if (match(line, /聚焦/)) prio = 33
if (match(line, /Move window$/)) prio = 34 if (match(line, /移动窗口$/)) prio = 34
if (match(line, /Resize window/)) prio = 35 if (match(line, /调整窗口大小/)) prio = 35
if (match(line, /Expand window/)) prio = 36 if (match(line, /扩展窗口/)) prio = 36
if (match(line, /Shrink window/)) prio = 37 if (match(line, /收缩窗口/)) prio = 37
if (match(line, /scratchpad/)) prio = 38 if (match(line, /便签区/)) prio = 38
if (match(line, /notification/)) prio = 39 if (match(line, /通知/)) prio = 39
if (match(line, /Toggle window transparency/)) prio = 40 if (match(line, /切换窗口透明/)) prio = 40
if (match(line, /Toggle workspace gaps/)) prio = 41 if (match(line, /切换窗口间距/)) prio = 41
if (match(line, /Toggle nightlight/)) prio = 42 if (match(line, /切换夜间模式/)) prio = 42
if (match(line, /Toggle locking/)) prio = 43 if (match(line, /切换空闲锁定/)) prio = 43
if (match(line, /group/)) prio = 94 if (match(line, /组内|分组/)) prio = 94
if (match(line, /Scroll active workspace/)) prio = 95 if (match(line, /工作区向(前|后)滚动/)) prio = 95
if (match(line, /Cycle to/)) prio = 96 if (match(line, /Cycle to/)) prio = 96
if (match(line, /Reveal active/)) prio = 97 if (match(line, /置顶显示/)) prio = 97
if (match(line, /Apple Display/)) prio = 98 if (match(line, /Apple Display/)) prio = 98
if (match(line, /XF86/)) prio = 99 if (match(line, /XF86/)) prio = 99
if (match(line, /Tmux keybindings/)) prio = 100 if (match(line, /Tmux 快捷键/)) prio = 100
if (match(line, /Herdr keybindings/)) prio = 101 if (match(line, /Herdr 快捷键/)) prio = 101
# print "priority<TAB>record" # print "priority<TAB>record"
printf "%d\t%s\n", prio, $0 printf "%d\t%s\n", prio, $0
+4 -4
View File
@@ -20,9 +20,9 @@ o.bind("SUPER + DOWN", "聚焦下方窗口", hl.dsp.focus({ direction = "d" }))
for workspace = 1, 10 do for workspace = 1, 10 do
local key = "code:" .. tostring(workspace + 9) local key = "code:" .. tostring(workspace + 9)
o.bind("SUPER + " .. key, "Switch to workspace " .. workspace, hl.dsp.focus({ workspace = tostring(workspace) })) o.bind("SUPER + " .. key, "切换到工作区 " .. workspace, hl.dsp.focus({ workspace = tostring(workspace) }))
o.bind("SUPER + SHIFT + " .. key, "Move window to workspace " .. workspace, hl.dsp.window.move({ workspace = tostring(workspace) })) o.bind("SUPER + SHIFT + " .. key, "窗口移到工作区 " .. workspace, hl.dsp.window.move({ workspace = tostring(workspace) }))
o.bind("SUPER + SHIFT + ALT + " .. key, "Move window silently to workspace " .. workspace, hl.dsp.window.move({ workspace = tostring(workspace), follow = false })) o.bind("SUPER + SHIFT + ALT + " .. key, "窗口静默移到工作区 " .. workspace, hl.dsp.window.move({ workspace = tostring(workspace), follow = false }))
end end
o.bind("SUPER + S", "切换便签区", hl.dsp.workspace.toggle_special("scratchpad")) o.bind("SUPER + S", "切换便签区", hl.dsp.workspace.toggle_special("scratchpad"))
@@ -91,7 +91,7 @@ o.bind("SUPER + ALT + mouse_down", "组内下一窗口", hl.dsp.group.next())
o.bind("SUPER + ALT + mouse_up", "组内上一窗口", hl.dsp.group.prev()) o.bind("SUPER + ALT + mouse_up", "组内上一窗口", hl.dsp.group.prev())
for index = 1, 5 do for index = 1, 5 do
o.bind("SUPER + ALT + code:" .. tostring(index + 9), "Switch to group window " .. index, hl.dsp.group.active({ index = index })) o.bind("SUPER + ALT + code:" .. tostring(index + 9), "切换到组内窗口 " .. index, hl.dsp.group.active({ index = index }))
end end
o.bind("SUPER + SLASH", "显示器缩放增大", "omarchy-hyprland-monitor-scaling up") o.bind("SUPER + SLASH", "显示器缩放增大", "omarchy-hyprland-monitor-scaling up")
+1 -1
View File
@@ -109,7 +109,7 @@ o.bind("SUPER + CTRL + T", "系统活动", { tui = "btop" })
for panel = 1, 9 do for panel = 1, 9 do
o.bind( o.bind(
"SUPER + CTRL + code:" .. tostring(panel + 9), "SUPER + CTRL + code:" .. tostring(panel + 9),
"Bar panel " .. panel, "顶栏面板 " .. panel,
"omarchy-shell -q shell togglePanelAt right " .. panel "omarchy-shell -q shell togglePanelAt right " .. panel
) )
end end
+1 -1
View File
@@ -265,7 +265,7 @@ shell_json=$(cd "$ROOT" && jq -r '[.bar.layout.center[].id] | join(",")' config/
[[ $shell_json != *"omarchy.calendar"* ]] || fail "clock hosts the calendar instead of a second bar pill" "center: $shell_json" [[ $shell_json != *"omarchy.calendar"* ]] || fail "clock hosts the calendar instead of a second bar pill" "center: $shell_json"
pass "default bar layout includes the clock widget" pass "default bar layout includes the clock widget"
grep -q 'o.bind("SUPER + CTRL + ALT + D", "Calendar", "omarchy-shell shell toggle omarchy.clock")' \ grep -q 'o.bind("SUPER + CTRL + ALT + D", "日历", "omarchy-shell shell toggle omarchy.clock")' \
"$ROOT/default/hypr/bindings/utilities.lua" || "$ROOT/default/hypr/bindings/utilities.lua" ||
fail "SUPER+CTRL+ALT+D toggles the calendar panel" fail "SUPER+CTRL+ALT+D toggles the calendar panel"
pass "SUPER+CTRL+ALT+D toggles the calendar panel" pass "SUPER+CTRL+ALT+D toggles the calendar panel"
+3 -3
View File
@@ -101,7 +101,7 @@ trap 'rm -rf "$tmpdir"' EXIT
fresh_home="$tmpdir/fresh-home" fresh_home="$tmpdir/fresh-home"
mkdir -p "$fresh_home" mkdir -p "$fresh_home"
fresh_output=$(run_application_bindings "$fresh_home") fresh_output=$(run_application_bindings "$fresh_home")
grep -Fq $'SUPER + RETURN Terminal' <<<"$fresh_output" || fail "default application bindings include essentials" grep -Fq $'SUPER + RETURN 终端' <<<"$fresh_output" || fail "default application bindings include essentials"
grep -Fq $'SUPER + SHIFT + A ChatGPT' <<<"$fresh_output" || fail "default application bindings include preinstalled web apps" grep -Fq $'SUPER + SHIFT + A ChatGPT' <<<"$fresh_output" || fail "default application bindings include preinstalled web apps"
pass "default application bindings load from package defaults" pass "default application bindings load from package defaults"
@@ -123,7 +123,7 @@ removed_home="$tmpdir/removed-home"
mkdir -p "$removed_home/.local/state/omarchy" mkdir -p "$removed_home/.local/state/omarchy"
touch "$removed_home/.local/state/omarchy/preinstalls-removed" touch "$removed_home/.local/state/omarchy/preinstalls-removed"
removed_output=$(run_application_bindings "$removed_home") removed_output=$(run_application_bindings "$removed_home")
grep -Fq $'SUPER + RETURN Terminal' <<<"$removed_output" || fail "preinstall removal keeps essential bindings" grep -Fq $'SUPER + RETURN 终端' <<<"$removed_output" || fail "preinstall removal keeps essential bindings"
if grep -Fq $'SUPER + SHIFT + A ChatGPT' <<<"$removed_output"; then if grep -Fq $'SUPER + SHIFT + A ChatGPT' <<<"$removed_output"; then
fail "preinstall removal skips preinstalled web app bindings" fail "preinstall removal skips preinstalled web app bindings"
fi fi
@@ -132,7 +132,7 @@ pass "preinstall removal flag skips optional application bindings"
variable_home="$tmpdir/variable-home" variable_home="$tmpdir/variable-home"
mkdir -p "$variable_home" mkdir -p "$variable_home"
variable_output=$(run_application_bindings "$variable_home" 'omarchy_preinstalled_bindings = false') variable_output=$(run_application_bindings "$variable_home" 'omarchy_preinstalled_bindings = false')
grep -Fq $'SUPER + RETURN Terminal' <<<"$variable_output" || fail "preinstalled binding variable keeps essential bindings" grep -Fq $'SUPER + RETURN 终端' <<<"$variable_output" || fail "preinstalled binding variable keeps essential bindings"
if grep -Fq $'SUPER + SHIFT + A ChatGPT' <<<"$variable_output"; then if grep -Fq $'SUPER + SHIFT + A ChatGPT' <<<"$variable_output"; then
fail "preinstalled binding variable skips optional application bindings" fail "preinstalled binding variable skips optional application bindings"
fi fi
+2 -2
View File
@@ -282,9 +282,9 @@ pass "webcam sizes stay distinct and inside a narrow region"
rm -f "$region_file" rm -f "$region_file"
grep -F 'o.bind("SUPER + ALT + code:34", "Make webcam overlay smaller", "omarchy-capture-webcam-resize smaller")' \ grep -F 'o.bind("SUPER + ALT + code:34", "缩小摄像头悬浮窗", "omarchy-capture-webcam-resize smaller")' \
"$ROOT/default/hypr/bindings/utilities.lua" >/dev/null || fail "webcam smaller hotkey is configured" "$ROOT/default/hypr/bindings/utilities.lua" >/dev/null || fail "webcam smaller hotkey is configured"
grep -F 'o.bind("SUPER + ALT + code:35", "Make webcam overlay larger", "omarchy-capture-webcam-resize larger")' \ grep -F 'o.bind("SUPER + ALT + code:35", "放大摄像头悬浮窗", "omarchy-capture-webcam-resize larger")' \
"$ROOT/default/hypr/bindings/utilities.lua" >/dev/null || fail "webcam larger hotkey is configured" "$ROOT/default/hypr/bindings/utilities.lua" >/dev/null || fail "webcam larger hotkey is configured"
pass "webcam resize hotkeys are configured" pass "webcam resize hotkeys are configured"