OSDN Git Service

check for autostart instance
[instantos/instantOS.git] / autostart.sh
1 #!/bin/bash
2
3 ####################################################
4 ## script for paperbenni-dwm autostart            ##
5 ####################################################
6
7 AUTOSTARTID="$(pgrep autostart.sh)"
8 n="${AUTOSTARTID//[^\n]/}"
9 if [ ${#n} -eq 1 ]; then
10         echo "No running instances found"
11 else
12         echo "another instance already running, exiting"
13         exit
14 fi
15
16 if command -v mpv && [ -e ~/paperbenni/boot.wav ]; then
17         mpv ~/paperbenni/boot.wav &
18 fi &
19
20 if ! [ -e ~/.dwmrunning ]; then
21         while :; do
22                 date="$(date)"
23                 ping -q -c 1 -W 1 8.8.8.8 && date="$date|""🌍"
24                 date="$date|🔊$(amixer get Master | egrep -o '[0-9]{1,3}%' | head -1)"
25                 xsetroot -name "$date"
26                 sleep 1m
27
28         done &
29         compton &
30 fi
31
32 touch ~/.dwmrunning
33
34 if ! pgrep mate-settings; then
35         while :; do
36                 if command -v mate-settings-daemon; then
37                         mate-settings-daemon
38                 else
39                         /usr/lib/mate-settings-daemon/mate-settings-daemon
40                 fi
41                 sleep 1
42         done &
43 fi
44
45 sleep 1
46
47 if ! pgrep deadd; then
48         while :; do
49                 deadd
50                 sleep 1
51         done &
52 fi
53
54 if [ -e ~/paperbenni/wallpaper.sh ]; then
55         bash ~/paperbenni/wallpaper.sh
56 fi