From 2eff2a37b392dc9933e773532e516660dc994b9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9B=B7=E7=94=B5=E8=8A=BD=E8=A1=A3?= Date: Tue, 25 Aug 2026 11:09:05 -0400 Subject: [PATCH] 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 Claude-Session: https://claude.ai/code/session_01QKxGW1raAWaqeU8WdHsMsp --- bin/omarchy-menu-keybindings | 94 ++++++++++---------- default/hypr/bindings/tiling.lua | 8 +- default/hypr/bindings/utilities.lua | 2 +- test/shell.d/clock-test.sh | 2 +- test/shell.d/hyprland-default-config-test.sh | 6 +- test/shell.d/screenrecording-test.sh | 4 +- 6 files changed, 58 insertions(+), 58 deletions(-) diff --git a/bin/omarchy-menu-keybindings b/bin/omarchy-menu-keybindings index 767b5dac..c1af0b2f 100755 --- a/bin/omarchy-menu-keybindings +++ b/bin/omarchy-menu-keybindings @@ -338,10 +338,10 @@ static_bindings() { # for interchangeably belong on one row. alternative_chord_actions() { cat <<'ACTIONS' -Close window -Calculator -Toggle scratchpad -Move window to scratchpad +关闭窗口 +计算器 +切换便签区 +窗口移入便签区 ACTIONS } @@ -442,58 +442,58 @@ prioritize_entries() { sub(/ \/ [^→]*→/, " →", line) prio = 50 - if (match(line, /Keybindings/)) prio = 0 - if (match(line, /Omarchy menu/)) prio = 1 - if (match(line, /Terminal/)) prio = 2 - if (match(line, /Browser/) && !match(line, /Browser[[:space:]]*\(/) && !match(line, /SUPER SHIFT.*\+.*B.*→.*Browser/)) prio = 3 - if (match(line, /File manager/) && !match(line, /File manager \(cwd\)/)) prio = 4 + if (match(line, /快捷键/)) prio = 0 + if (match(line, /Omarchy 菜单/)) prio = 1 + if (match(line, /终端/)) prio = 2 + if (match(line, /浏览器/) && !match(line, /浏览器(/) && !match(line, /SUPER SHIFT.*\+.*B.*→.*浏览器/)) prio = 3 + if (match(line, /文件管理器/) && !match(line, /文件管理器(当前目录)/)) prio = 4 if (match(line, /Launch apps/)) prio = 5 - if (match(line, /System menu/)) prio = 6 - if (match(line, /Theme menu/)) prio = 7 - if (match(line, /Full screen/)) prio = 8 - if (match(line, /Full width/)) prio = 9 - if (match(line, /Close window/)) prio = 10 - if (match(line, /Close all windows/)) prio = 11 - if (match(line, /Lock system/)) prio = 12 - if (match(line, /Toggle window floating/)) prio = 13 - if (match(line, /Toggle window split/)) prio = 14 - if (match(line, /Pop window/)) prio = 15 - if (match(line, /Universal/)) prio = 16 - if (match(line, /Clipboard/)) prio = 17 + if (match(line, /系统菜单/)) prio = 6 + if (match(line, /主题菜单/)) prio = 7 + if (match(line, /全屏/)) prio = 8 + if (match(line, /全宽/)) prio = 9 + if (match(line, /关闭窗口/)) prio = 10 + if (match(line, /关闭所有窗口/)) prio = 11 + if (match(line, /锁定系统/)) prio = 12 + if (match(line, /切换窗口浮动/)) prio = 13 + if (match(line, /切换窗口分割/)) prio = 14 + if (match(line, /弹出窗口/)) prio = 15 + if (match(line, /通用/)) prio = 16 + if (match(line, /剪贴板/)) prio = 17 if (match(line, /Audio controls/)) prio = 18 if (match(line, /Bluetooth controls/)) prio = 19 if (match(line, /Wifi controls/)) prio = 20 - if (match(line, /Emojis/)) prio = 21 - if (match(line, /Color picker/)) prio = 22 - if (match(line, /Screenshot/)) prio = 23 - if (match(line, /Screenrecording/)) prio = 24 + if (match(line, /表情/)) prio = 21 + if (match(line, /取色器/)) prio = 22 + if (match(line, /截图/)) prio = 23 + if (match(line, /录屏/)) prio = 24 if (match(line, /Tmux/)) prio = 25 if (match(line, /Herdr/)) prio = 26 - if (match(line, /SUPER SHIFT.*\+.*B.*→.*Browser/)) prio = 27 - if (match(line, /File manager \(cwd\)/)) prio = 28 - if (match(line, /(Switch|Next|Former|Previous).*workspace/)) prio = 29 - if (match(line, /Move window to workspace/)) prio = 30 - if (match(line, /Move window silently to workspace/)) prio = 31 - if (match(line, /Swap window/)) prio = 32 - if (match(line, /Focus/)) prio = 33 - if (match(line, /Move window$/)) prio = 34 - if (match(line, /Resize window/)) prio = 35 - if (match(line, /Expand window/)) prio = 36 - if (match(line, /Shrink window/)) prio = 37 - if (match(line, /scratchpad/)) prio = 38 - if (match(line, /notification/)) prio = 39 - if (match(line, /Toggle window transparency/)) prio = 40 - if (match(line, /Toggle workspace gaps/)) prio = 41 - if (match(line, /Toggle nightlight/)) prio = 42 - if (match(line, /Toggle locking/)) prio = 43 - if (match(line, /group/)) prio = 94 - if (match(line, /Scroll active workspace/)) prio = 95 + if (match(line, /SUPER SHIFT.*\+.*B.*→.*浏览器/)) prio = 27 + if (match(line, /文件管理器(当前目录)/)) prio = 28 + if (match(line, /(切换到|下一|上一|上次)工作区/)) prio = 29 + if (match(line, /窗口移到工作区/)) prio = 30 + if (match(line, /窗口静默移到工作区/)) prio = 31 + if (match(line, /互换/)) prio = 32 + if (match(line, /聚焦/)) prio = 33 + if (match(line, /移动窗口$/)) prio = 34 + if (match(line, /调整窗口大小/)) prio = 35 + if (match(line, /扩展窗口/)) prio = 36 + if (match(line, /收缩窗口/)) prio = 37 + if (match(line, /便签区/)) prio = 38 + if (match(line, /通知/)) prio = 39 + if (match(line, /切换窗口透明/)) prio = 40 + if (match(line, /切换窗口间距/)) prio = 41 + if (match(line, /切换夜间模式/)) prio = 42 + if (match(line, /切换空闲锁定/)) prio = 43 + if (match(line, /组内|分组/)) prio = 94 + if (match(line, /工作区向(前|后)滚动/)) prio = 95 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, /XF86/)) prio = 99 - if (match(line, /Tmux keybindings/)) prio = 100 - if (match(line, /Herdr keybindings/)) prio = 101 + if (match(line, /Tmux 快捷键/)) prio = 100 + if (match(line, /Herdr 快捷键/)) prio = 101 # print "priorityrecord" printf "%d\t%s\n", prio, $0 diff --git a/default/hypr/bindings/tiling.lua b/default/hypr/bindings/tiling.lua index 109401d7..1fb5e64f 100644 --- a/default/hypr/bindings/tiling.lua +++ b/default/hypr/bindings/tiling.lua @@ -20,9 +20,9 @@ o.bind("SUPER + DOWN", "聚焦下方窗口", hl.dsp.focus({ direction = "d" })) for workspace = 1, 10 do local key = "code:" .. tostring(workspace + 9) - o.bind("SUPER + " .. key, "Switch to workspace " .. 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 + ALT + " .. key, "Move window silently to workspace " .. workspace, hl.dsp.window.move({ workspace = tostring(workspace), follow = false })) + o.bind("SUPER + " .. key, "切换到工作区 " .. workspace, hl.dsp.focus({ workspace = tostring(workspace) })) + o.bind("SUPER + SHIFT + " .. key, "窗口移到工作区 " .. workspace, hl.dsp.window.move({ workspace = tostring(workspace) })) + o.bind("SUPER + SHIFT + ALT + " .. key, "窗口静默移到工作区 " .. workspace, hl.dsp.window.move({ workspace = tostring(workspace), follow = false })) end 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()) 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 o.bind("SUPER + SLASH", "显示器缩放增大", "omarchy-hyprland-monitor-scaling up") diff --git a/default/hypr/bindings/utilities.lua b/default/hypr/bindings/utilities.lua index 75e6b386..109fa9eb 100644 --- a/default/hypr/bindings/utilities.lua +++ b/default/hypr/bindings/utilities.lua @@ -109,7 +109,7 @@ o.bind("SUPER + CTRL + T", "系统活动", { tui = "btop" }) for panel = 1, 9 do o.bind( "SUPER + CTRL + code:" .. tostring(panel + 9), - "Bar panel " .. panel, + "顶栏面板 " .. panel, "omarchy-shell -q shell togglePanelAt right " .. panel ) end diff --git a/test/shell.d/clock-test.sh b/test/shell.d/clock-test.sh index e10d62f1..7f1970c4 100755 --- a/test/shell.d/clock-test.sh +++ b/test/shell.d/clock-test.sh @@ -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" 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" || fail "SUPER+CTRL+ALT+D toggles the calendar panel" pass "SUPER+CTRL+ALT+D toggles the calendar panel" diff --git a/test/shell.d/hyprland-default-config-test.sh b/test/shell.d/hyprland-default-config-test.sh index e35baba7..6829a2da 100644 --- a/test/shell.d/hyprland-default-config-test.sh +++ b/test/shell.d/hyprland-default-config-test.sh @@ -101,7 +101,7 @@ trap 'rm -rf "$tmpdir"' EXIT fresh_home="$tmpdir/fresh-home" mkdir -p "$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" pass "default application bindings load from package defaults" @@ -123,7 +123,7 @@ removed_home="$tmpdir/removed-home" mkdir -p "$removed_home/.local/state/omarchy" touch "$removed_home/.local/state/omarchy/preinstalls-removed" 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 fail "preinstall removal skips preinstalled web app bindings" fi @@ -132,7 +132,7 @@ pass "preinstall removal flag skips optional application bindings" variable_home="$tmpdir/variable-home" mkdir -p "$variable_home" 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 fail "preinstalled binding variable skips optional application bindings" fi diff --git a/test/shell.d/screenrecording-test.sh b/test/shell.d/screenrecording-test.sh index 7859ec14..754f7788 100644 --- a/test/shell.d/screenrecording-test.sh +++ b/test/shell.d/screenrecording-test.sh @@ -282,9 +282,9 @@ pass "webcam sizes stay distinct and inside a narrow region" 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" -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" pass "webcam resize hotkeys are configured"