summaryrefslogtreecommitdiff
path: root/x11-themes/background-lnxpcs/files/i3background
blob: faec41e8c1494e016d1d2ceacefd6086288ee1a2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/sh
BACKS="/usr/share/backgrounds"
BACKS="/home/cynerd/src/lnxpcs/walls/solarized-dark"
# Set background
if [ -n "$DISPLAY" ]; then
	# Only current one
	feh --randomize --no-fehbg --bg-center "$BACKS"
else
	# All instances
	for socket in `find /tmp/i3-* -name ipc-socket\*`; do
		i3-msg -s $socket "exec feh --randomize --no-fehbg --bg-center '$BACKS'"
	done
fi
# Set cron
if ! crontab -l | grep -q i3background; then
	TCRN="$(mktemp)"
	crontab -l > "$TCRN"
	echo "* * * * * i3background" >> "$TCRN"
	crontab "$TCRN"
	rm "$TCRN"
fi