Trim launcher overhead for terminals and web apps (#13423)

omarchy-launch-webapp asked xdg-settings for the default browser with
BROWSER still set to omarchy-launch-browser, which sends it down a
slower path to the same answer: ~105ms instead of ~30ms on every web app
launch. Unset it, as omarchy-launch-browser already does.

omarchy-cmd-terminal-cwd found the focused terminal's shell with pgrep,
which scans all of /proc on every new terminal. Read the terminal's
child lists from /proc instead, keeping the newest child as before.

Web app wrapper overhead drops from ~111ms to ~34ms, and a new terminal
appears in ~77ms instead of ~90ms.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
David Heinemeier HanssonandClaude Opus 5.5 authored and GitHub committed 2026-09-27 19:03:54 +02:00
1 parent 804749970a
commit 25ead28f90
3 files changed
+58 -2

No files matched your search

+10 -1
View File
@@ -11,7 +11,16 @@ if [[ -S $kitty_socket ]]; then
cwd=$(kitten @ --to "unix:$kitty_socket" ls --match "state:focused" 2>/dev/null |
jq -r '.[].tabs[].windows[].cwd // empty')
else
shell_pid=$(pgrep -P "$terminal_pid" | tail -n1)
# The newest child, as pgrep -P | tail -n1 found it, read from the kernel's
# child lists: pgrep scans all of /proc on every new terminal.
shell_pid=""
for children_file in /proc/"$terminal_pid"/task/*/children; do
[[ -r $children_file ]] || continue
read -ra children <"$children_file" || true
for child in "${children[@]}"; do
(( child > ${shell_pid:-0} )) && shell_pid=$child
done
done
if [[ -n $shell_pid ]]; then
cwd=$(readlink -f "/proc/$shell_pid/cwd" 2>/dev/null)
+3 -1
View File
@@ -3,7 +3,9 @@
# omarchy:summary=Launch a URL as a web app in the default supported browser
# omarchy:args=<url>
browser=$(xdg-settings get default-web-browser)
# The session sets BROWSER to omarchy-launch-browser, which sends xdg-settings
# down a slower path (~100ms against ~30ms) to the same answer.
browser=$(env -u BROWSER xdg-settings get default-web-browser)
case $browser in
google-chrome* | brave* | microsoft-edge* | opera* | vivaldi* | helium*) ;;