Renamed volume script
authorCian Bagshaw <cian@cianb.xyz>
Thu, 15 Jun 2023 23:51:51 +0000 (00:51 +0100)
committerCian Bagshaw <cian@cianb.xyz>
Thu, 15 Jun 2023 23:51:51 +0000 (00:51 +0100)
Renamed 'gvol' ("get volume") to, simply, 'vol' as it can now set volume as
well.

.config/i3/config
.config/i3blocks/config
.local/bin/gvol [deleted file]
.local/bin/vol [new file with mode: 0755]

index 212b951..6d95e78 100755 (executable)
@@ -12,12 +12,12 @@ exec_always picom
 floating_modifier $mod
 
 # volumes
-bindsym $mod+plus      exec amixer set Master  5%+ && notify-send " $(gvol) (+5%)"
-bindsym $mod+minus     exec amixer set Master  5%- && notify-send " $(gvol) (-5%)"
-bindsym $mod+Shift+plus                exec amixer set Capture 5%+ && notify-send "  $(gvol Capture) (+5%)"
-bindsym $mod+Shift+minus       exec amixer set Capture 5%- && notify-send "  $(gvol Capture) (-5%)"
-bindsym $mod+backslash                 exec amixer set Master  toggle && notify-send " $(gvol)"
-bindsym $mod+Shift+backslash   exec amixer set Capture toggle && notify-send " $(gvol Capture)"
+bindsym $mod+plus                              exec notify-send " $(vol Master 5%+) (+5%)"
+bindsym $mod+minus                             exec notify-send " $(vol Master 5%-) (-5%)"
+bindsym $mod+backslash                 exec notify-send " $(vol Master toggle)"
+bindsym $mod+Shift+plus                        exec notify-send " $(vol Capture 5%+) (+5%)"
+bindsym $mod+Shift+minus               exec notify-send " $(vol Capture 5%-) (-5%)"
+bindsym $mod+Shift+backslash   exec notify-send " $(vol Capture toggle)"
 
 # start a terminal
 bindsym $mod+Return                    exec alacritty 
index 34e4d05..0ae279d 100644 (file)
@@ -8,12 +8,12 @@ command=uptime -p
 interval=60
 
 [speaker volume]
-command=gvol
+command=vol
 label= 
 interval=10
 
 [mic volume]
-command=gvol Capture
+command=vol Capture
 label= 
 interval=10
 
diff --git a/.local/bin/gvol b/.local/bin/gvol
deleted file mode 100755 (executable)
index 26cd776..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/bin/sh
-# vol - get/set volume of alsa control using amixer
-# $1: control name (default is 'Master')
-# $2: set the volume to value (optional)
-
-amixer \
-       $( [ -z "$2" ] && echo "get"    || echo "set" ) \
-       $( [ -z "$1" ] && echo "Master" || echo "$1" ) \
-       "$2" \
-       | sed -nE       -e '/\[on\]/    { s/.*\[([0-9]+%)\].*/\1/;      p; q }' \
-                               -e '/\[off\]/   { s/.*/MUTE/;                           p; q }' 
diff --git a/.local/bin/vol b/.local/bin/vol
new file mode 100755 (executable)
index 0000000..26cd776
--- /dev/null
@@ -0,0 +1,11 @@
+#!/bin/sh
+# vol - get/set volume of alsa control using amixer
+# $1: control name (default is 'Master')
+# $2: set the volume to value (optional)
+
+amixer \
+       $( [ -z "$2" ] && echo "get"    || echo "set" ) \
+       $( [ -z "$1" ] && echo "Master" || echo "$1" ) \
+       "$2" \
+       | sed -nE       -e '/\[on\]/    { s/.*\[([0-9]+%)\].*/\1/;      p; q }' \
+                               -e '/\[off\]/   { s/.*/MUTE/;                           p; q }'