Files
omarchy/bin/omarchy-theme-bg-set
T
David Heinemeier HanssonandClaude Opus 5.5 1ac31e55ae Never leave the desktop without a wallpaper after a theme intro (#15000)
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>
2026-10-11 21:42:00 +09:00

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"