-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsetbg.sh
More file actions
executable file
·43 lines (34 loc) · 836 Bytes
/
Copy pathsetbg.sh
File metadata and controls
executable file
·43 lines (34 loc) · 836 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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/bash
if ! command -v feh &> /dev/null; then
echo "feh is not installed"
exit
fi
DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
FILES=$(find $DIR -type f | grep XPP | sort)
TIMEOUT_MIN=0
setBackground()
{
if test "`find ~/.fehbg -mmin +$TIMEOUT_MIN`"; then
FILE=$(echo "$FILES" | grep "M4x_$1_" | grep -v NoMoon | shuf -n 1)
echo "SET NEW BACKGROUND: $FILE"
feh --bg-fill $FILE
else
~/.fehbg
fi
}
while true; do
HOUR=$(date +%H)
if test $HOUR -gt 20 -o $HOUR -le 5; then
setBackground "Night"
elif test $HOUR -gt 17; then
setBackground "Sunset"
elif test $HOUR -gt 10; then
setBackground "Day"
elif test $HOUR -gt 7; then
setBackground "Morning"
elif test $HOUR -gt 5; then
setBackground "Sunrise"
fi
TIMEOUT_MIN=15
sleep 5
done