blob: c63424e5102a945a8fe6b249cd351f915198271d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
#!/bin/sh
BACKS="/usr/share/backgrounds"
# Set background
if [ -n "$DISPLAY" ]; then
# Only current one
feh --randomize --no-fehbg --bg-center "$BACKS"
else
# All instances
for socket in $(find /run/user/$(id -u)/i3 /tmp/i3-$(id -un).* -name ipc-socket\* 2>/dev/null); do
i3-msg -s $socket "exec feh --randomize --no-fehbg --bg-center '$BACKS'"
done
fi
# Set cron
if ! crontab -l 2>/dev/null | grep -q i3background; then
TCRN="$(mktemp)"
crontab -l 2>/dev/null > "$TCRN"
echo "* * * * * i3background" >> "$TCRN"
crontab "$TCRN"
rm "$TCRN"
fi
|