/ de-omarchy / bin / omarchy-theme-bg-set
swadhinbiswas Initial de-omarchy: Omarchy UI layer for Arch-based distros · 8/22/2026
9f393b2
26 lines · 732 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/bin/bash

# omarchy:summary=Set the current background image
# omarchy:args=<path-to-image>
# omarchy:examples=omarchy theme bg set ~/Pictures/background.png

if [[ -z $1 ]]; then
  echo "Usage: omarchy-theme-bg-set <path-to-image>" >&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
ln -nsf "$BACKGROUND" "$CURRENT_BACKGROUND_LINK"

# Update the live shell background immediately when it is running. The
# background plugin also polls this symlink, but IPC avoids the visible delay.
omarchy-shell -q background set "$BACKGROUND"