summaryrefslogtreecommitdiff
path: root/autostart.sh
blob: 344a9e4aca2cc4e7079f81531b935daf1a294cae (plain)
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
43
44
#!/bin/sh
runifnot () {
  if type $1 >/dev/null; then
    echo $1
    if [ -z "$(pgrep -Uzachir -f $1)" ]; then
      $@ &
    fi
  fi
}
killandrun () {
  if type $1 >/dev/null; then
    echo $1
    if [ -n "$(pgrep -Uzachir -f $1)" ]; then
      pkill -Uzachir $1
    fi
    $@ &
  fi
}

if [ -n "${WAYLAND_DISPLAY}${DISPLAY}" ]; then
  notify-sound.sh off &
  runifnot caffeine
  if [ -n "$WAYLAND_DISPLAY" ]; then
    runifnot swayidle
    launch_waybar.sh "$(crcparse WC)"
    killandrun swaybg -i ~/background.jpg
    if [ -n "$DISPLAY" ]; then
      xrdb ~/.Xresources
    fi
  else
    #runifnot picom
    runifnot xss-lock slockd
    runifnot sxhkd
    if "$(type xmonad >/dev/null 2>&1)"; then
      if ["$(crcparse WM)" = "$(which xmonad)" ]; then
        runifnot stalonetray
      fi
    fi
    xwallpaper --zoom ~/background.jpg
    setxkbmap -option "caps:escape"
  fi
fi

[ -x "$XDG_CONFIG_HOME/computerrc.sh" ] && "$XDG_CONFIG_HOME/computerrc.sh"