mirror of
https://github.com/arthur-pbty/arthur-os.git
synced 2026-08-01 20:28:16 +02:00
Cache warming
This commit is contained in:
+12
-3
@@ -1,13 +1,14 @@
|
||||
#!/bin/bash
|
||||
|
||||
# omarchy:summary=Open a generic image selector menu
|
||||
# omarchy:args=[--selected <image>] [--colors-file <path>] [--print-name] <image-dir>...
|
||||
# omarchy:args=[--selected <image>] [--colors-file <path>] [--print-name] [--cache-only] <image-dir>...
|
||||
|
||||
OMARCHY_PATH=${OMARCHY_PATH:-$HOME/.local/share/omarchy}
|
||||
|
||||
selected_image=""
|
||||
colors_file=""
|
||||
print_name=false
|
||||
cache_only=false
|
||||
image_dirs=()
|
||||
|
||||
while [[ $# -gt 0 ]]; do
|
||||
@@ -24,8 +25,12 @@ while [[ $# -gt 0 ]]; do
|
||||
print_name=true
|
||||
shift
|
||||
;;
|
||||
--cache-only)
|
||||
cache_only=true
|
||||
shift
|
||||
;;
|
||||
--help|-h)
|
||||
echo "Usage: omarchy-menu-images [--selected <image>] [--colors-file <path>] [--print-name] <image-dir>..."
|
||||
echo "Usage: omarchy-menu-images [--selected <image>] [--colors-file <path>] [--print-name] [--cache-only] <image-dir>..."
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
@@ -36,7 +41,7 @@ while [[ $# -gt 0 ]]; do
|
||||
done
|
||||
|
||||
if (( ${#image_dirs[@]} == 0 )); then
|
||||
echo "Usage: omarchy-menu-images [--selected <image>] [--colors-file <path>] [--print-name] <image-dir>..." >&2
|
||||
echo "Usage: omarchy-menu-images [--selected <image>] [--colors-file <path>] [--print-name] [--cache-only] <image-dir>..." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -133,6 +138,10 @@ fi
|
||||
rows_payload=${rows//$'\t'/$'\f'}
|
||||
rows_payload=${rows_payload//$'\n'/$'\v'}
|
||||
|
||||
if [[ $cache_only == true ]]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [[ -S $socket_path && $selector_qml -nt $socket_path ]]; then
|
||||
quickshell kill -p "$selector_qml" >/dev/null 2>&1 || true
|
||||
rm -f "$socket_path"
|
||||
|
||||
Executable
+10
@@ -0,0 +1,10 @@
|
||||
#!/bin/bash
|
||||
|
||||
# omarchy:summary=Cache background switcher thumbnails for the current theme
|
||||
|
||||
theme_name=$(cat "$HOME/.config/omarchy/current/theme.name" 2>/dev/null)
|
||||
|
||||
omarchy-menu-images \
|
||||
--cache-only \
|
||||
"$HOME/.config/omarchy/current/theme/backgrounds" \
|
||||
"$HOME/.config/omarchy/backgrounds/$theme_name"
|
||||
@@ -71,3 +71,6 @@ omarchy-theme-set-keyboard
|
||||
|
||||
# Call hook on theme set
|
||||
omarchy-hook theme-set "$THEME_NAME" >/dev/null
|
||||
|
||||
# Warm the background selector cache after the theme is applied, off the critical path.
|
||||
omarchy-theme-bg-cache >/dev/null 2>&1 &
|
||||
|
||||
Reference in New Issue
Block a user