From: Cian Bagshaw Date: Thu, 15 Jun 2023 23:51:51 +0000 (+0100) Subject: Renamed volume script X-Git-Url: https://tests.cianb.xyz/?a=commitdiff_plain;h=bb7a91410c20ab7fc4fb0362718a785d44c32115;p=dotFiles Renamed volume script Renamed 'gvol' ("get volume") to, simply, 'vol' as it can now set volume as well. --- diff --git a/.config/i3/config b/.config/i3/config index 212b951..6d95e78 100755 --- a/.config/i3/config +++ b/.config/i3/config @@ -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 diff --git a/.config/i3blocks/config b/.config/i3blocks/config index 34e4d05..0ae279d 100644 --- a/.config/i3blocks/config +++ b/.config/i3blocks/config @@ -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 index 26cd776..0000000 --- a/.local/bin/gvol +++ /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 index 0000000..26cd776 --- /dev/null +++ b/.local/bin/vol @@ -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 }'