-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlivewall.sh
More file actions
37 lines (33 loc) · 1.22 KB
/
livewall.sh
File metadata and controls
37 lines (33 loc) · 1.22 KB
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
#!/bin/sh
if [ "$1" = "-f" ]; then
if pgrep -x mpvpaper >/dev/null; then
killall mpvpaper livewall_auto_pause.sh
setsid awww-daemon >/dev/null 2>&1 &
else
pgrep -x awww-daemon >/dev/null && killall awww-daemon
/usr/bin/mpvpaper eDP-1 -fo "input-ipc-server=/tmp/mpv-socket no-audio loop no-config" "/mnt/Disk_D/Backgrounds/Live/active"
~/Scripts/livewall_auto_pause.sh >/dev/null 2>&1 &
fi
exit 0
fi
change_wallpaper() {
current_state=$(cat /sys/class/power_supply/*/online)
if [ "$current_state" = 0 ]; then
pgrep -x mpvpaper >/dev/null && killall mpvpaper livewall_auto_pause.sh
setsid awww-daemon >/dev/null 2>&1 &
elif [ "$current_state" = 1 ]; then
pgrep -x awww-daemon >/dev/null && killall awww-daemon
/usr/bin/mpvpaper eDP-1 -fo "input-ipc-server=/tmp/mpv-socket no-audio loop no-config" "/mnt/Disk_D/Backgrounds/Live/active"
~/Scripts/livewall_auto_pause.sh >/dev/null 2>&1 &
fi
}
if ! [ -f /tmp/livewall.tmp ]; then
cat /sys/class/power_supply/*/online >/tmp/livewall.tmp
change_wallpaper
fi
while true; do
echo "new loop"
echo "$current_state" >/tmp/livewall.tmp
[ "$(cat /sys/class/power_supply/*/online)" != "$(cat /tmp/livewall.tmp)" ] && change_wallpaper
sleep 5
done