summaryrefslogtreecommitdiff
path: root/.local/bin/volumectl
blob: d8766b735572ff1c43cafb2475549588460a659f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/bash

#	Usage:

#		The first argument is the percentage by which you should
#		change the volume

#		The second argument should be `+` or `-`
#		to choose wether to increment or decrement audio.
#		If no second argument is given, the audio will be SET
#		to a set percentage fixed by the first argument.
case "$1" in
	mute) amixer set Master toggle ;;
		 *)  pcnt="$1"
				 sign="$2"
				 amixer set Master $pcnt%$sign ;;
esac

mute=""
vol=$(awk '/%/ {gsub(/[\[\]]/,""); print $4}' <(amixer sget Master))
amixer sget Master | grep off && mute="(muted)"
notify-send.sh -t 1000 --replace-file /tmp/vol-notif -a Volume "$vol $mute"