Files
dotfiles/.local/bin/station-bg-set
T

27 lines
941 B
Bash
Raw Normal View History

2026-03-06 22:33:30 +00:00
#!/bin/bash
# Sets the specified image as the current background
BACKGROUND="$1"
CURRENT_BACKGROUND_LINK="$HOME/.local/state/station/background"
2026-09-01 22:09:11 +01:00
if [[ -f $BACKGROUND ]]; then
# Create symlink to the new background
ln -nsf "$BACKGROUND" "$CURRENT_BACKGROUND_LINK"
fi
2026-03-06 22:33:30 +00:00
2026-03-08 20:51:14 +00:00
wal -i "$CURRENT_BACKGROUND_LINK"
2026-03-06 22:33:30 +00:00
# Kill existing swaybg and start new one
pkill -x swaybg
2026-03-30 19:40:32 +01:00
if [[ $(hyprctl monitors -j | jq 'length') -eq 2 ]]; then
station-bg-split "$CURRENT_BACKGROUND_LINK" "/tmp/bg"
2026-09-01 22:09:11 +01:00
first_mon=$(hyprctl monitors -j | jq -r 'map(select(.x == 0)) | .[0].name')
second_mon=$(hyprctl monitors -j | jq -r 'map(select(.x > 0)) | .[0].name')
2026-03-30 19:40:32 +01:00
setsid uwsm-app -- swaybg -o "$first_mon" -i /tmp/bg/background_left -m fill >/dev/null 2>&1 &
setsid uwsm-app -- swaybg -o "$second_mon" -i /tmp/bg/background_right -m fill >/dev/null 2>&1 &
else
setsid uwsm-app -- swaybg -i "$CURRENT_BACKGROUND_LINK" -m fill >/dev/null 2>&1 &
fi