-
Notifications
You must be signed in to change notification settings - Fork 7
/
volume.sh
executable file
·55 lines (43 loc) · 1.12 KB
/
volume.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/usr/bin/env bash
#genmon script for displaying the volume
#clicking the button opens "PulseAudio Volume Control (pavucontrol)"
# pulsemixer --get-volume | awk {'print $1'}
readonly VOLUME_VALUE=`pulsemixer --get-volume | awk {'print $1'}`
if [ "${VOLUME_VALUE}" -lt 25 ]; then
VOLUME_ICON=""
elif [ "${VOLUME_VALUE}" -ge 25 ] && [ "${VOLUME_VALUE}" -le 60 ]; then
VOLUME_ICON=""
else
VOLUME_ICON=""
fi
MUTE_STATUS=`pactl list sinks | awk '/Mute:/{print $2;exit}'`
if [[ $MUTE_STATUS == "yes" ]]; then
VOLUME_ICON="🔇"
fi
VOLUME="${VOLUME_ICON} "
VOLUME+="${VOLUME_VALUE}"
# Panel
INFO="<txt>"
INFO+="${VOLUME}"
INFO+="</txt>"
if command -v pavucontrol >/dev/null 2>&1; then
INFO+="<txtclick>pavucontrol</txtclick>" # clicking on the icon opens XFCE power manager
fi
# CSS Styling
CSS="<css>"
CSS+=".genmon_valuebutton {
background-color: #e47841;
color:#ffffff;
padding-left:10px;
padding-right:10px;
font-weight:bold;
}
.genmon_valuebutton:hover {
border: 0px solid #fff;
}
"
CSS+="</css>"
# Panel Print
echo -e "${INFO}"
# Add Styling
echo -e "${CSS}"