From: Armaan Bhojwani Date: Fri, 29 Jan 2021 02:54:30 +0000 (-0500) Subject: Audio-set: Add script. Volume change script for WM X-Git-Tag: v0.0.1~51 X-Git-Url: https://git.armaanb.net/?p=bin.git;a=commitdiff_plain;h=8bcdc9b10495dd3d8be425a971ffd5a191d31e35 Audio-set: Add script. Volume change script for WM Instead of calling pactl or amixer directly, you can use this script. The advantage is that this script checks whether the sound is muted, and unmutes it for you when you change the volume, more closely mimicking the behavior of most desktop environments. It also sends a notification with the current audio status. This implementation relies on amixer and pulseaudio, although could easily work with an alsa-only setup if that's your thing, just by replacing the pactl commands with amixer (or any other alsa mixer) commands. --- diff --git a/audio-set b/audio-set new file mode 100755 index 0000000..572bdf5 --- /dev/null +++ b/audio-set @@ -0,0 +1,12 @@ +#!/usr/bin/env bash +# When changing volume, if muted, unmute + +if [[ ${1} ]]; then + [[ $(amixer sget Master | tail -n 1 | grep "off") ]] && + pactl set-sink-mute 0 toggle + pactl set-sink-volume 0 ${1}% +else + pactl set-sink-mute 0 toggle +fi + +notify-send "Volume" "$(amixer sget Master | tail -n 1)" -t 1000