Make the theme picker open instantly (#13403)

* Run menu summon actions in-process

A menu action that only summons another shell plugin spawned bash and a
qs ipc client to ask this same shell to do it, about 60ms of the path.
Call shell.summon directly instead, and fall back to bash when the call
is refused or the action is anything more than a bare summon.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Open the theme picker from rows held in the shell

Opening the theme picker ran omarchy-theme-switcher to rebuild its index
and then made a second IPC call, about 170ms before the picker mapped.
The picker now holds the theme rows itself, opens from them at once, and
refreshes them behind the open via omarchy-theme-switcher --print-rows.
It applies the chosen theme with omarchy-theme-set directly, so
omarchy-theme-set no longer preloads the picker.

From the keybinding to the overlay mapped drops from ~245ms to ~83ms.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Keep the image picker surface mapped between opens

Each open mapped a fresh surface, which rendered its first frames before
Hyprland sent its fractional scale: the pixel ratio stepped 2, 1, then
1.6, so the picker flashed blurry for ~130ms and re-uploaded every
thumbnail texture. Keep the surface and park it transparent and
input-less on the bottom layer while closed, since anything on the
overlay layer blocks direct scanout for fullscreen apps. It follows the
focused monitor on each open.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

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 15:10:49 +02:00
1 parent e558224acf
commit 24f1243120
14 files changed
+232 -27

No files matched your search

+14 -2
View File
@@ -1,7 +1,7 @@
#!/bin/bash
# omarchy:summary=Open a generic image selector menu
# omarchy:args=[--selected <image>] [--print-name] [--show-labels] [--filterable] [--lazy-thumbnails] [--preload] [--cache-only] <image-dir>...
# omarchy:args=[--selected <image>] [--print-name] [--show-labels] [--filterable] [--lazy-thumbnails] [--preload] [--cache-only] [--print-rows] <image-dir>...
selected_image=""
print_name=false
@@ -11,10 +11,11 @@ lazy_thumbnails=false
prepare_only=false
preload=false
cache_only=false
print_rows=false
image_dirs=()
usage() {
echo "Usage: omarchy-menu-images [--selected <image>] [--print-name] [--show-labels] [--filterable] [--lazy-thumbnails] [--preload] [--cache-only] <image-dir>..."
echo "Usage: omarchy-menu-images [--selected <image>] [--print-name] [--show-labels] [--filterable] [--lazy-thumbnails] [--preload] [--cache-only] [--print-rows] <image-dir>..."
}
while (( $# > 0 )); do
@@ -56,6 +57,10 @@ while (( $# > 0 )); do
cache_only=true
shift
;;
--print-rows)
print_rows=true
shift
;;
--help|-h)
usage
exit 0
@@ -328,6 +333,13 @@ if [[ $cache_only == true || $prepare_only == true ]]; then
exit 0
fi
# The shell keeps a copy of these rows so its picker can open without waiting
# on this script, and reads them back from stdout to refresh that copy.
if [[ $print_rows == true ]]; then
printf '%s\n' "$rows"
exit 0
fi
# Image rows can contain newlines and tabs, which don't survive positional
# shell IPC arguments. Base64-encode for transit; the ImagePicker plugin
# Qt.atob()s on the other side.
+2 -4
View File
@@ -423,9 +423,7 @@ if [[ $THEME_HEADLESS != "1" ]]; then
# Call hook on theme set
omarchy-hook theme-set "$THEME_NAME" >/dev/null
# Warm selector caches after the theme is applied. The shell hot-reloads theme
# colors/backgrounds, so keep the running instance alive and preload the picker
# rows/selection to avoid first-open carousel settling after a theme change.
omarchy-theme-switcher --preload >/dev/null 2>&1
# Warm the background selector's thumbnails. The theme picker keeps its own
# rows in the shell and refreshes them each time it opens.
omarchy-theme-bg-cache >/dev/null 2>&1 &
fi
+7 -5
View File
@@ -2,10 +2,12 @@
# omarchy:summary=Open the Omarchy theme switcher
preload=false
print_rows=false
if [[ $1 == "--preload" ]]; then
preload=true
# The shell's picker opens from rows it already holds and runs this to refresh
# them, so the theme list never waits on the index below.
if [[ $1 == "--print-rows" ]]; then
print_rows=true
shift
fi
@@ -121,8 +123,8 @@ menu_args=(
--selected "$selected_preview"
)
if [[ $preload == true ]]; then
menu_args+=(--preload)
if [[ $print_rows == true ]]; then
menu_args+=(--print-rows)
fi
exec omarchy-menu-images "${menu_args[@]}" "$preview_dir"