dotfiles

Torpy's handcrafted dootfiles.
Log | Files | Refs | README

sb-tasks (603B)


      1 #!/bin/sh
      2 
      3 # Originally by Andr3as07 <https://github.com/Andr3as07>
      4 # Some changes by Luke
      5 # Rebuild by Tenyun
      6 
      7 # This block displays the number running background tasks.  Requires tsp.
      8 
      9 num=$(tsp -l | awk -v numr=0 -v numq=0 '{if (/running/)numr++; if (/queued/)numq++} END{print numr+numq"("numq")"}')
     10 
     11 # Handle mouse clicks
     12 case $BLOCK_BUTTON in
     13 	1) setsid -f "$TERMINAL" -e tsp -l ;;
     14 	3) notify-send "Tasks module" "🤖: number of running/queued background tasks
     15 - Left click opens tsp" ;; # Right click
     16 	6) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;;
     17 esac
     18 
     19 [ "$num" != "0(0)" ] &&
     20 	echo "🤖$num"