Skip to content

Commit 98a93e6

Browse files
committed
adding time_wallpaper.sh
1 parent 2c06c77 commit 98a93e6

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

time_wallpaper.sh

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/bin/bash
2+
# a small script that set the wallpaper for my computer with nitrogen
3+
# it sets the wallpaper based on the current time
4+
# it was made to be run in the background
5+
6+
refresh=120 # in seconds
7+
min_rating=5 # minimum stars
8+
9+
morning="6" # when starts the morning ?
10+
day="9" # when starts the night ?
11+
evening="18" # when starts the evening ?
12+
night="22" # when starts the night ?
13+
14+
# directory of time wallpapers
15+
morning_pics="$HOME/.local/share/wallpapers/morning/"
16+
day_pics="$HOME/.local/share/wallpapers/day/"
17+
evening_pics="$HOME/.local/share/wallpapers/evening/"
18+
night_pics="$HOME/.local/share/wallpapers/night/"
19+
20+
while [[ true ]]; do
21+
time=$(date +"%H")
22+
if [[ $time -ge $night ]] || [[ $time -lt $morning ]]; then
23+
# night
24+
killall nitrogen
25+
nitrogen --set-zoom-fill $night_pics
26+
elif [[ $time -lt $day ]]; then
27+
# morning
28+
killall nitrogen
29+
nitrogen --set-zoom-fill $morning_pics
30+
elif [[ $time -lt $evening ]]; then
31+
# day
32+
killall nitrogen
33+
nitrogen --set-zoom-fill $day_pics &
34+
elif [[ $day -lt $night ]]; then
35+
# evening
36+
killall nitrogen
37+
nitrogen --set-zoom-fill $evening_pics &
38+
fi
39+
40+
sleep $refresh
41+
done

0 commit comments

Comments
 (0)