scripts

scripts to make my pc work
Index Commits Files Refs
pactlsetvolume (860B)
   1 #!/bin/bash
   2 
   3 # amount=$(echo "$1" | cut -d " " -f 2)
   4 amount=$2
   5 curr=$(pamixer --get-volume)
   6 
   7 send_notification() {
   8     dunstify -r 13123 -h "int:value:$1" "$2 Volume ($1%)" -t 2000
   9 }
  10 
  11 get_icon() {
  12     if [ "$curr" -gt "50" ]; then
  13         icon="🔊"
  14     elif [ "$curr" -eq "0" ]; then
  15         icon="🔇"
  16     elif [ "$curr" -lt "25" ]; then
  17         icon="🔈"
  18     else
  19         icon="🔉"
  20     fi
  21 }
  22 
  23 if [ $amount == "0" ]; then
  24     pactl set-sink-mute @DEFAULT_SINK@ toggle;
  25     if [ "$(pamixer --get-mute)" == "false" ]; then
  26         get_icon $icon
  27         send_notification $curr $icon
  28     else
  29         send_notification "0" "🔇"
  30     fi
  31     exit
  32 fi
  33 
  34 # min=$((0 + $amount))
  35 # max=$((100 - $amount))
  36 
  37 # (($curr<=$max)) && $(pactl set-sink-volume @DEFAULT_SINK@ +$amount%)
  38 
  39 pamixer $1 $2
  40 # curr=$(pamixer --get-volume)
  41 # [ $curr -ne $min ] && [ $curr -ne $max ] && curr=$(($curr + $amount))
  42 
  43 get_icon
  44 # send_notification $curr $icon