dotfiles

My personal shell configs and stuff
git clone git://git.alex.balgavy.eu/dotfiles.git
Log | Files | Refs | Submodules | README | LICENSE

dwmblock-unsleep (636B)


      1 #!/bin/sh
      2 # dwmblocks script for preventing sleep
      3 
      4 # Interfaces:
      5 # (list with `nmcli --get-values GENERAL.DEVICE,GENERAL.TYPE device show`)
      6 wired=enp0s31f6
      7 wireless=wlp0s20f3
      8 # there's probably a way to change these but I'd have to know all files to update...
      9 
     10 case "$BUTTON" in
     11   3)
     12     if pgrep unsleep >/dev/null 2>&1; then
     13       killall unsleep
     14       notify 'Enabling sleep' ''
     15     else
     16       setsid -f unsleep >/dev/null 2>&1
     17       notify 'Disabling sleep' ''
     18     fi
     19     pkill -RTMIN+9 dwmblocks
     20     ;;
     21   6) "$TERMINAL" -e "$EDITOR" "$0"
     22     ;;
     23 esac
     24 
     25 if pgrep unsleep >/dev/null 2>&1; then
     26   printf ' '
     27 else
     28   printf '🌙 '
     29 fi