Problem
bin/omarchy-cmd-terminal-cwd:7 finds the focused window's pid from the text form of hyprctl activewindow:
terminal_pid=${1:-$(hyprctl activewindow | awk '/pid:/ {print $2}')}The text form opens with a header, Window <address> -> <title>:. When the title ends in pid (a terminal showing ~/rapid, or rapid), the header contains pid: too, so awk prints two words: the window address, then the pid. The result matches no kitty socket and no /proc/<pid> path, so the new terminal opens in $HOME instead of the focused terminal's directory.
Repro (the header is what Hyprland writes; no Hyprland needed):
$ printf 'Window 55d8 -> ~/rapid:\n\tpid: 4242\n' | awk '/pid:/ {print $2}'
55d8
4242Any title that contains pid: anywhere does the same, for example pid: 3 - htop.
Change
Ask for JSON, as the other omarchy-hyprland-window-* scripts do (jq -r '.pid // empty'). The title is a JSON string there and no longer reaches the match. test/shell.d/terminal-cwd-test.sh gains a case with a title ending in pid; its stub answers the text form with the title in the header, so the case fails on the tag and passes with the change.
ShellCheck (-x -S warning) is clean. The test needs /proc and was not run on macOS; it should run in Omarchy's own CI.
Dupe check: terminal-cwd issues (#3963, #6230, #10840, #12282) and PRs (#5049, #6042, #12283, #15007) are about other causes (Ghostty, kitty, helper processes, multiplexers). None covers the title match.
Found while testing Omarchy 4.5.0-rc1.
[Medium impact] The PR appears safe to merge.
Summary
omarchy-cmd-terminal-cwdnow reads the focused window’s PID from JSON instead of matching text that can include the window title.No actionable issues found. Tests were inspected but not run.
Reviews (1) · Last reviewed commit: "Read the focused window's pid from hyprc..." · Reviewed by Greptile