dotfiles

<-- duh.
git clone https://hhvn.uk/dotfiles
git clone git://hhvn.uk/dotfiles
Log | Files | Refs | Submodules | LICENSE

hvol (705B)


      1 #!/bin/sh
      2 
      3 command -v sndioctl >/dev/null && {
      4 	echo "$1" | grep '%' >/dev/null && {
      5 		case "$(echo "$1" | sed -E 's/.*(.)$/\1/')" in
      6 			"+") t="+" ;;
      7 			"-") t="-" ;;
      8 			*) t="" ;;
      9 		esac
     10 
     11 		percent=$(echo "$1" | tr -d '%+-')
     12 		units=$(echo "scale=3; $percent / 100" | bc)
     13 		
     14 		sndioctl output.level="${t}${units}"
     15 
     16 		exit 0
     17 	}
     18 
     19 	case "$1" in
     20 		"mute") sndioctl output.mute=1 ;;
     21 		"unmute") sndioctl output.mute=0 ;;
     22 		"toggle")
     23 			case "$(sndioctl output.mute | sed 's/.*=//')" in
     24 				1) sndioctl output.mute=0 ;;
     25 				0) sndioctl output.mute=1 ;;
     26 			esac
     27 			;;
     28 		*) sndioctl output.level=$1 ;;
     29 	esac
     30 } || amixer set Master "$1"
     31 
     32 block=$($HOME/.scripts/dwmbar/vol)
     33 printf '%s' "$block" > /tmp/blocks/vol