]> git.armaanb.net Git - bin.git/blob - setter
pubup: change subdomain and variable expansion
[bin.git] / setter
1 #!/usr/bin/env bash
2 # Sends a notification with the time, battery level, and volume
3
4 if [[ ${1} == "status" || -z ${1} ]]; then
5   dunstify -h string:x-canonical-private-synchronous:status \
6    "$(date "+%A %Y-%m-%d, %r")"\
7    "$(acpi | tail -c +12)\n$(amixer sget Master | tail -n 1 \
8    | cut -d " " -f 7-)" \
9    -t 2000
10
11 elif [[ ${1} == "audio" ]]; then
12   if [[ ${2} ]]; then
13     [[ $(amixer sget Master | tail -n 1 | grep "off") ]] &&
14       pactl set-sink-mute 0 toggle
15     pactl set-sink-volume 0 ${2}%
16   else
17     pactl set-sink-mute 0 toggle
18   fi
19
20   mutes="Unmuted"
21   [[ $(amixer sget Master | tail -n 1 | grep "off") ]] && mutes="Muted"
22
23   dunstify -h string:x-canonical-private-synchronous:audio \
24     "Volume" "${mutes}" \
25     -h int:value:"$(amixer sget Master | tail -n 1 | cut -d '[' -f 2 | \
26     head -c +2)" \
27     -t 1000
28
29 elif [[ ${1} == "brightness" ]]; then
30   brightnessctl set ${2}
31   dunstify -h string:x-canonical-private-synchronous:brightness \
32     "Brightness" "$(brightnessctl | grep % | tail -c +22)" \
33     -h int:value:"$(brightnessctl | grep % | cut -d '(' -f 2 | head -c +3)" \
34     -t 1000
35 fi