summaryrefslogtreecommitdiff
path: root/.local/bin/dwmbar/dwmb-volume
blob: 422c6e6b7f29d7fe8294f560c3f0ce548e52fa63 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/sh

# Low volume threshold (for the icon to change)
low="50"

# High volume icon
icon=" "

# Get the percentage
vol="$(amixer sget Master | tail -n 1 | sed "s/.*\[\([0-9]*\)%\]/\1/")"

# Change to low volume icon if below threshold
[[ "$vol" -lt "$low" ]] && \
icon=" "

# Change to muted icon if necessary
echo $vol | grep off &>/dev/null  && icon=" "

echo " $icon$(echo $vol | sed "s/\s\[.*//")%"

#   