scripts

scripts to make my pc work
Index Commits Files Refs
statusbar/sb-volume (1036B)
   1 #!/bin/sh
   2 
   3 # Prints the current volume or 🔇 if muted.
   4 
   5 # case $BLOCK_BUTTON in
   6 #     1) setsid -f "$TERMINAL" -e pulsemixer ;;
   7 #     2) pamixer -t ;;
   8 #     4) pamixer --allow-boost -i 1 ;;
   9 #     5) pamixer --allow-boost -d 1 ;;
  10 #     3) notify-send "📢 Volume module" "\- Shows volume 🔊, 🔇 if muted.
  11 # - Middle click to mute.
  12 # - Scroll to change." ;;
  13 #     6) "$TERMINAL" -e "$EDITOR" "$0" ;;
  14 # esac
  15 
  16 # [ $(pamixer --get-mute) = true ] && echo "🔇  ^c#FF2a2a^0%^d^" && exit
  17 # [ $(pamixer --get-mute) = true ] && echo "🔇  0%" && exit
  18 
  19 # [ $(awk -F "[][]" '/Left:/ { print $4 }' <(amixer sget Master)) == "off" ] && echo "🔇  0%" && exit
  20 
  21 vol="$(pamixer --get-volume)"
  22 # vol="$(awk -F "[][]" '/Left:/ { $2 - substr($2, 2, lenghth($2) - 1); print $2 }' <(amixer sget Master))"
  23 
  24 [ $(pamixer --get-mute) = true ] && printf "🔇%3d%s" $vol "%" && exit
  25 
  26 if [ "$vol" -gt "49" ]; then
  27     icon="🔊"
  28 elif [ "$vol" -eq "0" ]; then
  29     icon="🔇"
  30 elif [ "$vol" -lt "25" ]; then
  31     icon="🔈"
  32 else
  33     icon="🔉"
  34 fi
  35 
  36 printf "%s%3d%s" "$icon" "$vol" "%"