summaryrefslogtreecommitdiff
path: root/.local/bin/volumectl
diff options
context:
space:
mode:
authorBenjamin Chausse <benjamin@chausse.xyz>2020-10-03 19:27:15 -0400
committerBenjamin Chausse <benjamin@chausse.xyz>2020-10-03 19:27:15 -0400
commite371d9edd474bcf89cf5d462eaccb8638900b390 (patch)
treeed07118f5c514a55f23a779a1507640e46fd9ed2 /.local/bin/volumectl
Initial commit
Diffstat (limited to '.local/bin/volumectl')
-rwxr-xr-x.local/bin/volumectl23
1 files changed, 23 insertions, 0 deletions
diff --git a/.local/bin/volumectl b/.local/bin/volumectl
new file mode 100755
index 0000000..d8766b7
--- /dev/null
+++ b/.local/bin/volumectl
@@ -0,0 +1,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"
+