use icons in status bar
This commit is contained in:
parent
010e919d3b
commit
a6043ad80d
3 changed files with 68 additions and 6 deletions
|
@ -1 +1 @@
|
||||||
dwm.font: Terminus-11
|
dwm.font: FiraMono Nerd Font:size=10
|
||||||
|
|
|
@ -35,6 +35,8 @@ SXMO_COMMON_INCLUDED=1
|
||||||
|
|
||||||
# shellcheck disable=SC2034
|
# shellcheck disable=SC2034
|
||||||
icon_chk="[x]" #we override this later if the user wants icons
|
icon_chk="[x]" #we override this later if the user wants icons
|
||||||
|
# shellcheck disable=SC2034
|
||||||
|
icon_wif="W" #we override this later if the user wants icons
|
||||||
|
|
||||||
[ "$SXMO_NO_ICONS" = "1" ] && return 0;
|
[ "$SXMO_NO_ICONS" = "1" ] && return 0;
|
||||||
|
|
||||||
|
@ -220,6 +222,8 @@ icon_wn2=""
|
||||||
icon_chk=""
|
icon_chk=""
|
||||||
# shellcheck disable=SC2034
|
# shellcheck disable=SC2034
|
||||||
icon_and=""
|
icon_and=""
|
||||||
|
# shellcheck disable=SC2034
|
||||||
|
icon_wif=""
|
||||||
|
|
||||||
#allow the user to override icons
|
#allow the user to override icons
|
||||||
if [ -x "$XDG_CONFIG_HOME/sxmo/hooks/icons" ]; then
|
if [ -x "$XDG_CONFIG_HOME/sxmo/hooks/icons" ]; then
|
||||||
|
|
|
@ -25,12 +25,12 @@ update() {
|
||||||
WIRELESS=""
|
WIRELESS=""
|
||||||
WLANSTATE="$(tr -d "\n" < /sys/class/net/wlan0/operstate)"
|
WLANSTATE="$(tr -d "\n" < /sys/class/net/wlan0/operstate)"
|
||||||
if [ "$WLANSTATE" = "up" ]; then
|
if [ "$WLANSTATE" = "up" ]; then
|
||||||
WIRELESS="W "
|
WIRELESS=" "
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# M symbol if modem monitoring is on & modem present
|
# M symbol if modem monitoring is on & modem present
|
||||||
MODEMMON=""
|
MODEMMON=""
|
||||||
pgrep -f sxmo_modemmonitor.sh && MODEMMON="M "
|
pgrep -f sxmo_modemmonitor.sh && MODEMMON=""
|
||||||
|
|
||||||
# Battery pct
|
# Battery pct
|
||||||
PCT="$(cat /sys/class/power_supply/*-battery/capacity)"
|
PCT="$(cat /sys/class/power_supply/*-battery/capacity)"
|
||||||
|
@ -38,21 +38,79 @@ update() {
|
||||||
cat /sys/class/power_supply/*-battery/status |
|
cat /sys/class/power_supply/*-battery/status |
|
||||||
cut -c1
|
cut -c1
|
||||||
)"
|
)"
|
||||||
|
if [ "$BATSTATUS" = "C" ]; then
|
||||||
|
if [ "$PCT" -lt 20 ]; then
|
||||||
|
BATSTATUS=""
|
||||||
|
elif [ "$PCT" -lt 30 ]; then
|
||||||
|
BATSTATUS=""
|
||||||
|
elif [ "$PCT" -lt 40 ]; then
|
||||||
|
BATSTATUS=""
|
||||||
|
elif [ "$PCT" -lt 60 ]; then
|
||||||
|
BATSTATUS=""
|
||||||
|
elif [ "$PCT" -lt 80 ]; then
|
||||||
|
BATSTATUS=""
|
||||||
|
elif [ "$PCT" -lt 90 ]; then
|
||||||
|
BATSTATUS=""
|
||||||
|
else
|
||||||
|
BATSTATUS=""
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
if [ "$PCT" -lt 10 ]; then
|
||||||
|
BATSTATUS=""
|
||||||
|
elif [ "$PCT" -lt 20 ]; then
|
||||||
|
BATSTATUS=""
|
||||||
|
elif [ "$PCT" -lt 30 ]; then
|
||||||
|
BATSTATUS=""
|
||||||
|
elif [ "$PCT" -lt 40 ]; then
|
||||||
|
BATSTATUS=""
|
||||||
|
elif [ "$PCT" -lt 50 ]; then
|
||||||
|
BATSTATUS=""
|
||||||
|
elif [ "$PCT" -lt 60 ]; then
|
||||||
|
BATSTATUS=""
|
||||||
|
elif [ "$PCT" -lt 70 ]; then
|
||||||
|
BATSTATUS=""
|
||||||
|
elif [ "$PCT" -lt 80 ]; then
|
||||||
|
BATSTATUS=""
|
||||||
|
elif [ "$PCT" -lt 90 ]; then
|
||||||
|
BATSTATUS=""
|
||||||
|
else
|
||||||
|
BATSTATUS=""
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
# Volume
|
# Volume
|
||||||
AUDIODEV="$(sxmo_audiocurrentdevice.sh)"
|
AUDIODEV="$(sxmo_audiocurrentdevice.sh)"
|
||||||
[ "$AUDIODEV" = "None" ] && VOL="" || VOL=$(echo "$AUDIODEV" | cut -c1 | tr L S)"$(
|
AUDIOSYMBOL=$(echo "$AUDIODEV" | cut -c1)
|
||||||
|
if [ "$AUDIOSYMBOL" = "L" ]; then
|
||||||
|
AUDIOSYMBOL="" #speakers, use no special symbol
|
||||||
|
elif [ "$AUDIOSYMBOL" = "H" ]; then
|
||||||
|
AUDIOSYMBOL=" "
|
||||||
|
elif [ "$AUDIOSYMBOL" = "E" ]; then
|
||||||
|
AUDIOSYMBOL=" " #earpiece
|
||||||
|
fi
|
||||||
|
VOL=0
|
||||||
|
[ "$AUDIODEV" = "None" ] && AUDIOSYMBOL="ﱝ" || VOL="$(
|
||||||
amixer sget "$AUDIODEV" |
|
amixer sget "$AUDIODEV" |
|
||||||
grep -oE '([0-9]+)%' |
|
grep -oE '([0-9]+)%' |
|
||||||
tr -d ' %' |
|
tr -d ' %' |
|
||||||
awk '{ s += $1; c++ } END { print s/c }' |
|
awk '{ s += $1; c++ } END { print s/c }' |
|
||||||
xargs printf %.0f
|
xargs printf %.0f
|
||||||
)"
|
)"
|
||||||
|
if [ "$AUDIODEV" != "None" ]; then
|
||||||
|
if [ "$VOL" -eq 0 ]; then
|
||||||
|
AUDIOSYMBOL="$AUDIOSYMBOLﱝ"
|
||||||
|
elif [ "$VOL" -lt 25 ]; then
|
||||||
|
AUDIOSYMBOL="$AUDIOSYMBOL奄"
|
||||||
|
elif [ "$VOL" -gt 75 ]; then
|
||||||
|
AUDIOSYMBOL="$AUDIOSYMBOL墳"
|
||||||
|
else
|
||||||
|
AUDIOSYMBOL="$AUDIOSYMBOL奔"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
# Time
|
# Time
|
||||||
TIME="$(date +%R)"
|
TIME="$(date +%R)"
|
||||||
|
|
||||||
BAR="${CALLINFO}${MODEMMON}${WIRELESS}${VOL} ${BATSTATUS}${PCT}% ${TIME}"
|
BAR="${CALLINFO}${MODEMMON}${WIRELESS} ${AUDIOSYMBOL} ${BATSTATUS} ${TIME}"
|
||||||
xsetroot -name "$BAR"
|
xsetroot -name "$BAR"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue