X-Git-Url: https://git.armaanb.net/?p=bin.git;a=blobdiff_plain;f=setter;h=b13adfbfffa5328a91a6383dafffeb461015803f;hp=abdffd589178b7bce2da77511623952c5f2788ea;hb=c95e95333f93130886fa49231679a02256cfdcef;hpb=bd5bcb193b135b4fba7e23e443cd6c27b16d22b8 diff --git a/setter b/setter index abdffd5..b13adfb 100755 --- a/setter +++ b/setter @@ -2,34 +2,34 @@ # Sends a notification with the time, battery level, and volume if [[ ${1} == "status" || -z ${1} ]]; then - dunstify -h string:x-canonical-private-synchronous:status \ - "$(date "+%A %Y-%m-%d, %r")"\ - "$(acpi | tail -c +12)\n$(amixer sget Master | tail -n 1 \ - | cut -d " " -f 7-)" \ - -t 2000 + dunstify -h string:x-canonical-private-synchronous:status \ + "$(date "+%A %Y-%m-%d, %r")"\ + "$(acpi | tail -c +12)\n$(amixer sget Master | tail -n 1 \ + | cut -d " " -f 7-)" \ + -t 2000 elif [[ ${1} == "audio" ]]; then - if [[ ${2} ]]; then - [[ $(amixer sget Master | tail -n 1 | grep "off") ]] && - pactl set-sink-mute 0 toggle - pactl set-sink-volume 0 ${2}% - else - pactl set-sink-mute 0 toggle - fi + if [[ ${2} ]]; then + [[ $(amixer sget Master | tail -n 1 | grep "off") ]] && + pactl set-sink-mute 0 toggle + pactl set-sink-volume 0 ${2}% + else + pactl set-sink-mute 0 toggle + fi - mutes="Unmuted" - [[ $(amixer sget Master | tail -n 1 | grep "off") ]] && mutes="Muted" + mutes="Unmuted" + [[ $(amixer sget Master | tail -n 1 | grep "off") ]] && mutes="Muted" - dunstify -h string:x-canonical-private-synchronous:audio \ - "Volume" "${mutes}" \ - -h int:value:"$(amixer sget Master | tail -n 1 | cut -d '[' -f 2 | \ - head -c +2)" \ - -t 1000 + dunstify -h string:x-canonical-private-synchronous:audio \ + "Volume" "${mutes}" \ + -h int:value:"$(amixer sget Master | tail -n 1 | cut -d '[' -f 2 | \ + head -c +2)" \ + -t 1000 elif [[ ${1} == "brightness" ]]; then - brightnessctl set ${2} - dunstify -h string:x-canonical-private-synchronous:brightness \ - "Brightness" "$(brightnessctl | grep % | tail -c +22)" \ - -h int:value:"$(brightnessctl | grep % | cut -d '(' -f 2 | head -c +3)" \ - -t 1000 + brightnessctl set ${2} + dunstify -h string:x-canonical-private-synchronous:brightness \ + "Brightness" "$(brightnessctl | grep % | tail -c +22)" \ + -h int:value:"$(brightnessctl | grep % | cut -d '(' -f 2 | head -c +3)" \ + -t 1000 fi