A theme switch that plays an intro gave the shell the new still only when the intro failed. The shell kept the old theme's path, which the theme swap deletes, and loaded it again when OWE handed the desktop back, leaving it empty. The new still is now handed over either way. The shell also re-reads the background link whenever OWE hands the desktop back or a wallpaper fails to load, falling back to the theme's first background when the link itself is broken. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
26 lines
738 B
Bash
Executable File
26 lines
738 B
Bash
Executable File
#!/bin/bash
|
|
|
|
# omarchy:summary=Set the current background image or video
|
|
# omarchy:args=<path-to-media>
|
|
# omarchy:examples=omarchy theme bg set ~/Pictures/background.png
|
|
|
|
if [[ -z $1 ]]; then
|
|
echo "Usage: omarchy-theme-bg-set <path-to-media>" >&2
|
|
exit 1
|
|
fi
|
|
|
|
BACKGROUND="$(realpath "$1")"
|
|
CURRENT_BACKGROUND_LINK="$HOME/.local/state/omarchy/current/background"
|
|
|
|
if [[ ! -f $BACKGROUND ]]; then
|
|
echo "File does not exist: $BACKGROUND" >&2
|
|
exit 1
|
|
fi
|
|
|
|
# Create symlink to the new background media
|
|
ln -nsf "$BACKGROUND" "$CURRENT_BACKGROUND_LINK"
|
|
|
|
# Update the live shell background when it is running. Nothing watches the
|
|
# symlink, so this is how the shell learns of the new background.
|
|
omarchy-shell -q background set "$BACKGROUND"
|