Files
omarchy/test/acceptance.d/shell-surfaces-test.sh
T
David Heinemeier HanssonandClaude Opus 5.5 24f1243120 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>
2026-09-27 15:10:49 +02:00

118 lines
4.7 KiB
Bash

#!/bin/bash
set -euo pipefail
source "$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)/base-test.sh"
open_and_close() {
local name="$1" plugin="$2" namespace="$3" payload="${4:-}"
if [[ -n $payload ]]; then
omarchy-shell shell summon "$plugin" "$payload" >/dev/null
else
omarchy-shell shell summon "$plugin" >/dev/null
fi
wait_until "$name opens" 15 layer_present "$namespace"
sleep 1
screenshot "success-$name-open"
omarchy-shell shell hide "$plugin" >/dev/null
wait_until "$name closes" 15 layer_absent "$namespace"
}
# Search and select an emoji. The host harness separately proves the shortcut
# with a QMP hardware key chord, while this test focuses on UI behavior.
omarchy-shell shell summon omarchy.emojis >/dev/null
wait_until "emoji picker opens" 15 layer_present "omarchy-emojis"
wtype "rocket"
sleep 1
screenshot "success-emoji-picker-search"
wtype -k Return
wait_until "emoji picker selection closes" 15 layer_absent "omarchy-emojis"
# Seed two clipboard entries, search for the older one, and copy it back out.
clipboard_token="Omarchy acceptance clipboard $(date +%s)"
printf '%s' "$clipboard_token" | wl-copy
wait_until "clipboard history captures test text" 15 grep -Fq "$clipboard_token" "$HOME/.local/state/omarchy/clipboard-history.json"
printf '%s' "clipboard decoy" | wl-copy
sleep 1
omarchy-shell shell summon omarchy.clipboard >/dev/null
wait_until "clipboard opens" 15 layer_present "omarchy-clipboard"
wtype "$clipboard_token"
wait_until "clipboard search finds test text" 15 screen_contains "Omarchy acceptance clipboard"
screenshot "success-clipboard-search"
wtype -M shift -k Return -m shift
wait_until "clipboard selection closes" 15 layer_absent "omarchy-clipboard"
wait_until "clipboard selection restores test text" 15 bash -c '[[ $(wl-paste --no-newline) == "$1" ]]' _ "$clipboard_token"
# Exercise the system branch without invoking any destructive action.
omarchy-shell shell summon omarchy.menu '{"menu":"system"}' >/dev/null
wait_until "system menu opens" 15 layer_present "omarchy-menu"
wait_until "system menu content is visible" 15 screen_contains "Shutdown"
screenshot "success-system-menu"
wtype -k Escape
wait_until "system menu closes" 15 layer_absent "omarchy-menu"
# Preview both visual selectors and cancel without changing user state. These
# cover thumbnail generation, the image-grid overlay, and current selection.
launch_app "omarchy-theme-bg-switcher"
wait_until "background selector opens" 30 layer_on_overlay "omarchy-image-selector"
sleep 1
screenshot "success-background-selector"
wtype -k Escape
wait_until "background selector closes" 15 layer_off_overlay "omarchy-image-selector"
launch_app "omarchy-theme-switcher"
wait_until "theme selector opens" 30 layer_on_overlay "omarchy-image-selector"
sleep 1
screenshot "success-theme-selector"
wtype -k Escape
wait_until "theme selector closes" 15 layer_off_overlay "omarchy-image-selector"
# Walk the reminder flow through each input screen, but dismiss before it
# schedules a real timer in the test user's session.
omarchy-shell shell summon omarchy.reminders >/dev/null
wait_until "reminder flow opens" 15 layer_present "omarchy-reminders"
screenshot "success-reminder-01-minutes-prompt"
wtype "5"
sleep 1
screenshot "success-reminder-02-minutes-entered"
wtype -k Return
wait_until "reminder message prompt opens" 15 screen_contains "Reminder message"
screenshot "success-reminder-03-message-prompt"
wtype -k Escape
wait_until "reminder flow closes" 15 layer_absent "omarchy-reminders"
# Render a real shell notification and clear it through the notification IPC.
omarchy-shell notifications dismissAll >/dev/null
omarchy-notification-send "Acceptance notification" "Shell notification rendering" --expire-time=15000
wait_until "notification popup opens" 15 layer_present "omarchy-notifications"
wait_until "notification content is visible" 15 screen_contains "Acceptance notification"
screenshot "success-notification-popup"
omarchy-shell notifications dismissAll >/dev/null
wait_until "notification popup closes" 15 layer_absent "omarchy-notifications"
# The menu's Apps submenu does the full launcher loop: open, search by
# typing, launch the top hit.
if window_present "(?i)omawrite" >/dev/null 2>&1; then
fail "app launch test starts with no Omawrite window" "an Omawrite window is already open"
fi
omarchy-menu summon apps >/dev/null
wait_until "apps menu opens" 15 layer_present "omarchy-menu"
sleep 1
screenshot "success-apps-menu-open"
wtype "omawrite"
sleep 1
screenshot "success-apps-menu-search"
wtype -k Return
wait_until "apps menu launches the top search hit" 60 window_present "(?i)omawrite"
wait_until "apps menu closes after launching" 15 layer_absent "omarchy-menu"
close_windows "(?i)omawrite"
wait_until "Omawrite window closes" 30 window_absent "(?i)omawrite"