From 131bdd3813c481f01df2af16bfda5553c37ec3ed Mon Sep 17 00:00:00 2001 From: self Date: Sun, 10 Apr 2022 12:43:52 +0100 Subject: Removed tone from change-audio script --- scripts/change-audio | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100755 scripts/change-audio (limited to 'scripts/change-audio') diff --git a/scripts/change-audio b/scripts/change-audio new file mode 100755 index 0000000..229c47f --- /dev/null +++ b/scripts/change-audio @@ -0,0 +1,21 @@ +#!/bin/bash +# change-audio +# Shamelessly copied from the Arch Linux wiki. + +# Arbitrary but unique message tag +msgTag="myvolume" + +# Change the volume using alsa(might differ if you use pulseaudio) +amixer -c 0 set Master "$@" > /dev/null + +# Query amixer for the current volume and whether or not the speaker is muted +volume="$(amixer -c 0 get Master | tail -1 | awk '{print $4}' | sed 's/[^0-9]*//g')" +mute="$(amixer -c 0 get Master | tail -1 | awk '{print $6}' | sed 's/[^a-z]*//g')" +if [[ $volume == 0 || "$mute" == "off" ]]; then + # Show the sound muted notification + dunstify -a "changeVolume" -u low -i audio-volume-muted -h string:x-dunst-stack-tag:$msgTag "Volume muted" +else + # Show the volume notification + dunstify -a "changeVolume" -u low -i audio-volume-high -h string:x-dunst-stack-tag:$msgTag \ + -h int:value:"$volume" "Volume: ${volume}%" +fi -- cgit v1.2.1