You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

209 lines
4.3 KiB

5 years ago
#!/usr/bin/env sh
# include common definitions
# shellcheck source=scripts/core/sxmo_common.sh
. "$(dirname "$0")/sxmo_common.sh"
Rework the status bar Goals of this patch : - display the signal quality I used a thermometer icon cause there is no available icon with a filleable bar o_O - display the currently used network technology (4g, 3g, etc...) I used the mapping from: https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/blob/master/include/ModemManager-enums.h#L220 Dylan also said: Anything from POTS to GPRS = 2G UMTS to EVDOB = 3G LTE = 4G 5GNR = 5G - display the modem infos when modemmonitor is disabled We want to decorelate the modem monitor from the icon. We still want to know easily if modem monitor is runing but we also want those modem infos if not. - simplify the modem state determination (no state file anymore) The statusbar probe mmcli itself. - fix the leading timer without call issue This was caused by the "pgrep -f" command that was matching itself. Using a simple "pgrep" looks good enough anyway. - fix some sxmo_statusbar update spaming issues (vol control) This one point took me a lot of time to findout a good solution. We want the USR1 kill to be spamable without causing issue to the displayed bar. We dont want mid rendered bar (half the icons). We dont want empty bars (empty stdout line). I use some variable to store pid, smart waits and a better trap function to make it to works cleanly. Now we can spam statusbarupdate. Only the last one will actually redraw the bar. Signed-off-by: Stacy Harper <contact@stacyharper.net> Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
3 years ago
percenticon() {
if [ "$1" -lt 20 ]; then
printf ""
elif [ "$1" -lt 40 ]; then
printf ""
elif [ "$1" -lt 60 ]; then
printf ""
elif [ "$1" -lt 80 ]; then
printf ""
else
printf ""
fi
}
bar() {
MMCLI="$(mmcli -m any -J)"
# In-call.. show length of call
Rework the status bar Goals of this patch : - display the signal quality I used a thermometer icon cause there is no available icon with a filleable bar o_O - display the currently used network technology (4g, 3g, etc...) I used the mapping from: https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/blob/master/include/ModemManager-enums.h#L220 Dylan also said: Anything from POTS to GPRS = 2G UMTS to EVDOB = 3G LTE = 4G 5GNR = 5G - display the modem infos when modemmonitor is disabled We want to decorelate the modem monitor from the icon. We still want to know easily if modem monitor is runing but we also want those modem infos if not. - simplify the modem state determination (no state file anymore) The statusbar probe mmcli itself. - fix the leading timer without call issue This was caused by the "pgrep -f" command that was matching itself. Using a simple "pgrep" looks good enough anyway. - fix some sxmo_statusbar update spaming issues (vol control) This one point took me a lot of time to findout a good solution. We want the USR1 kill to be spamable without causing issue to the displayed bar. We dont want mid rendered bar (half the icons). We dont want empty bars (empty stdout line). I use some variable to store pid, smart waits and a better trap function to make it to works cleanly. Now we can spam statusbarupdate. Only the last one will actually redraw the bar. Signed-off-by: Stacy Harper <contact@stacyharper.net> Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
3 years ago
if pgrep sxmo_modemcall.sh > /dev/null; then
NOWS="$(date +"%s")"
CALLSTARTS="$(date +"%s" -d "$(
grep -aE 'call_start|call_pickup' "$XDG_DATA_HOME"/sxmo/modem/modemlog.tsv |
tail -n1 |
cut -f1
)")"
Rework the status bar Goals of this patch : - display the signal quality I used a thermometer icon cause there is no available icon with a filleable bar o_O - display the currently used network technology (4g, 3g, etc...) I used the mapping from: https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/blob/master/include/ModemManager-enums.h#L220 Dylan also said: Anything from POTS to GPRS = 2G UMTS to EVDOB = 3G LTE = 4G 5GNR = 5G - display the modem infos when modemmonitor is disabled We want to decorelate the modem monitor from the icon. We still want to know easily if modem monitor is runing but we also want those modem infos if not. - simplify the modem state determination (no state file anymore) The statusbar probe mmcli itself. - fix the leading timer without call issue This was caused by the "pgrep -f" command that was matching itself. Using a simple "pgrep" looks good enough anyway. - fix some sxmo_statusbar update spaming issues (vol control) This one point took me a lot of time to findout a good solution. We want the USR1 kill to be spamable without causing issue to the displayed bar. We dont want mid rendered bar (half the icons). We dont want empty bars (empty stdout line). I use some variable to store pid, smart waits and a better trap function to make it to works cleanly. Now we can spam statusbarupdate. Only the last one will actually redraw the bar. Signed-off-by: Stacy Harper <contact@stacyharper.net> Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
3 years ago
CALLSECONDS="$(printf "%s - %s" "$NOWS" "$CALLSTARTS" | bc)"
printf "%ss " "$CALLSECONDS"
fi
Rework the status bar Goals of this patch : - display the signal quality I used a thermometer icon cause there is no available icon with a filleable bar o_O - display the currently used network technology (4g, 3g, etc...) I used the mapping from: https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/blob/master/include/ModemManager-enums.h#L220 Dylan also said: Anything from POTS to GPRS = 2G UMTS to EVDOB = 3G LTE = 4G 5GNR = 5G - display the modem infos when modemmonitor is disabled We want to decorelate the modem monitor from the icon. We still want to know easily if modem monitor is runing but we also want those modem infos if not. - simplify the modem state determination (no state file anymore) The statusbar probe mmcli itself. - fix the leading timer without call issue This was caused by the "pgrep -f" command that was matching itself. Using a simple "pgrep" looks good enough anyway. - fix some sxmo_statusbar update spaming issues (vol control) This one point took me a lot of time to findout a good solution. We want the USR1 kill to be spamable without causing issue to the displayed bar. We dont want mid rendered bar (half the icons). We dont want empty bars (empty stdout line). I use some variable to store pid, smart waits and a better trap function to make it to works cleanly. Now we can spam statusbarupdate. Only the last one will actually redraw the bar. Signed-off-by: Stacy Harper <contact@stacyharper.net> Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
3 years ago
MODEMSTATUS=""
if [ -z "$MMCLI" ]; then
printf ""
else
MODEMSTATUS="$(printf %s "$MMCLI" | jq -r .modem.generic.state)"
case "$MODEMSTATUS" in
locked)
printf ""
;;
registered|connected)
MODEMSIGNAL="$(printf %s "$MMCLI" | jq -r '.modem.generic."signal-quality".value')"
percenticon "$MODEMSIGNAL"
;;
disconnected)
printf "ﲁ"
;;
esac
fi
if [ "$MODEMSTATUS" = "connected" ]; then
printf " "
USEDTECHS="$(printf %s "$MMCLI" | jq -r '.modem.generic."access-technologies"[]')"
case "$USEDTECHS" in
*5gnr*)
printf 5g # no icon yet
;;
*lte*)
printf
;;
*umts*|*hsdpa*|*hsupa*|*hspa*|*1xrtt*|*evdo0*|*evdoa*|*evdob*)
printf
;;
*edge*)
printf E
;;
*pots*|*gsm*|*gprs*)
printf
;;
esac
fi
if pgrep -f sxmo_modemmonitor.sh > /dev/null; then
printf " "
fi
WLANSTATE="$(tr -d "\n" < /sys/class/net/wlan0/operstate)"
if [ "$WLANSTATE" = "up" ]; then
Rework the status bar Goals of this patch : - display the signal quality I used a thermometer icon cause there is no available icon with a filleable bar o_O - display the currently used network technology (4g, 3g, etc...) I used the mapping from: https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/blob/master/include/ModemManager-enums.h#L220 Dylan also said: Anything from POTS to GPRS = 2G UMTS to EVDOB = 3G LTE = 4G 5GNR = 5G - display the modem infos when modemmonitor is disabled We want to decorelate the modem monitor from the icon. We still want to know easily if modem monitor is runing but we also want those modem infos if not. - simplify the modem state determination (no state file anymore) The statusbar probe mmcli itself. - fix the leading timer without call issue This was caused by the "pgrep -f" command that was matching itself. Using a simple "pgrep" looks good enough anyway. - fix some sxmo_statusbar update spaming issues (vol control) This one point took me a lot of time to findout a good solution. We want the USR1 kill to be spamable without causing issue to the displayed bar. We dont want mid rendered bar (half the icons). We dont want empty bars (empty stdout line). I use some variable to store pid, smart waits and a better trap function to make it to works cleanly. Now we can spam statusbarupdate. Only the last one will actually redraw the bar. Signed-off-by: Stacy Harper <contact@stacyharper.net> Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
3 years ago
printf " "
fi
Rework the status bar Goals of this patch : - display the signal quality I used a thermometer icon cause there is no available icon with a filleable bar o_O - display the currently used network technology (4g, 3g, etc...) I used the mapping from: https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/blob/master/include/ModemManager-enums.h#L220 Dylan also said: Anything from POTS to GPRS = 2G UMTS to EVDOB = 3G LTE = 4G 5GNR = 5G - display the modem infos when modemmonitor is disabled We want to decorelate the modem monitor from the icon. We still want to know easily if modem monitor is runing but we also want those modem infos if not. - simplify the modem state determination (no state file anymore) The statusbar probe mmcli itself. - fix the leading timer without call issue This was caused by the "pgrep -f" command that was matching itself. Using a simple "pgrep" looks good enough anyway. - fix some sxmo_statusbar update spaming issues (vol control) This one point took me a lot of time to findout a good solution. We want the USR1 kill to be spamable without causing issue to the displayed bar. We dont want mid rendered bar (half the icons). We dont want empty bars (empty stdout line). I use some variable to store pid, smart waits and a better trap function to make it to works cleanly. Now we can spam statusbarupdate. Only the last one will actually redraw the bar. Signed-off-by: Stacy Harper <contact@stacyharper.net> Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
3 years ago
# symbol if wireguard/vpn is connected
VPNDEVICE="$(nmcli con show | grep vpn | awk '{ print $4 }')"
WGDEVICE="$(nmcli con show | grep wireguard | awk '{ print $4 }')"
if [ -n "$VPNDEVICE" ] && [ "$VPNDEVICE" != "--" ]; then
printf " "
elif [ -n "$WGDEVICE" ] && [ "$WGDEVICE" != "--" ]; then
printf " "
fi
# Find battery and get percentage + status
for power_supply in /sys/class/power_supply/*; do
if [ "$(cat "$power_supply"/type)" = "Battery" ]; then
PCT="$(cat "$power_supply"/capacity)"
BATSTATUS="$(cut -c1 "$power_supply"/status)"
fi
done
Rework the status bar Goals of this patch : - display the signal quality I used a thermometer icon cause there is no available icon with a filleable bar o_O - display the currently used network technology (4g, 3g, etc...) I used the mapping from: https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/blob/master/include/ModemManager-enums.h#L220 Dylan also said: Anything from POTS to GPRS = 2G UMTS to EVDOB = 3G LTE = 4G 5GNR = 5G - display the modem infos when modemmonitor is disabled We want to decorelate the modem monitor from the icon. We still want to know easily if modem monitor is runing but we also want those modem infos if not. - simplify the modem state determination (no state file anymore) The statusbar probe mmcli itself. - fix the leading timer without call issue This was caused by the "pgrep -f" command that was matching itself. Using a simple "pgrep" looks good enough anyway. - fix some sxmo_statusbar update spaming issues (vol control) This one point took me a lot of time to findout a good solution. We want the USR1 kill to be spamable without causing issue to the displayed bar. We dont want mid rendered bar (half the icons). We dont want empty bars (empty stdout line). I use some variable to store pid, smart waits and a better trap function to make it to works cleanly. Now we can spam statusbarupdate. Only the last one will actually redraw the bar. Signed-off-by: Stacy Harper <contact@stacyharper.net> Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
3 years ago
printf " "
if [ "$BATSTATUS" = "C" ]; then
if [ "$PCT" -lt 20 ]; then
Rework the status bar Goals of this patch : - display the signal quality I used a thermometer icon cause there is no available icon with a filleable bar o_O - display the currently used network technology (4g, 3g, etc...) I used the mapping from: https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/blob/master/include/ModemManager-enums.h#L220 Dylan also said: Anything from POTS to GPRS = 2G UMTS to EVDOB = 3G LTE = 4G 5GNR = 5G - display the modem infos when modemmonitor is disabled We want to decorelate the modem monitor from the icon. We still want to know easily if modem monitor is runing but we also want those modem infos if not. - simplify the modem state determination (no state file anymore) The statusbar probe mmcli itself. - fix the leading timer without call issue This was caused by the "pgrep -f" command that was matching itself. Using a simple "pgrep" looks good enough anyway. - fix some sxmo_statusbar update spaming issues (vol control) This one point took me a lot of time to findout a good solution. We want the USR1 kill to be spamable without causing issue to the displayed bar. We dont want mid rendered bar (half the icons). We dont want empty bars (empty stdout line). I use some variable to store pid, smart waits and a better trap function to make it to works cleanly. Now we can spam statusbarupdate. Only the last one will actually redraw the bar. Signed-off-by: Stacy Harper <contact@stacyharper.net> Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
3 years ago
printf ""
elif [ "$PCT" -lt 30 ]; then
Rework the status bar Goals of this patch : - display the signal quality I used a thermometer icon cause there is no available icon with a filleable bar o_O - display the currently used network technology (4g, 3g, etc...) I used the mapping from: https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/blob/master/include/ModemManager-enums.h#L220 Dylan also said: Anything from POTS to GPRS = 2G UMTS to EVDOB = 3G LTE = 4G 5GNR = 5G - display the modem infos when modemmonitor is disabled We want to decorelate the modem monitor from the icon. We still want to know easily if modem monitor is runing but we also want those modem infos if not. - simplify the modem state determination (no state file anymore) The statusbar probe mmcli itself. - fix the leading timer without call issue This was caused by the "pgrep -f" command that was matching itself. Using a simple "pgrep" looks good enough anyway. - fix some sxmo_statusbar update spaming issues (vol control) This one point took me a lot of time to findout a good solution. We want the USR1 kill to be spamable without causing issue to the displayed bar. We dont want mid rendered bar (half the icons). We dont want empty bars (empty stdout line). I use some variable to store pid, smart waits and a better trap function to make it to works cleanly. Now we can spam statusbarupdate. Only the last one will actually redraw the bar. Signed-off-by: Stacy Harper <contact@stacyharper.net> Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
3 years ago
printf ""
elif [ "$PCT" -lt 40 ]; then
Rework the status bar Goals of this patch : - display the signal quality I used a thermometer icon cause there is no available icon with a filleable bar o_O - display the currently used network technology (4g, 3g, etc...) I used the mapping from: https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/blob/master/include/ModemManager-enums.h#L220 Dylan also said: Anything from POTS to GPRS = 2G UMTS to EVDOB = 3G LTE = 4G 5GNR = 5G - display the modem infos when modemmonitor is disabled We want to decorelate the modem monitor from the icon. We still want to know easily if modem monitor is runing but we also want those modem infos if not. - simplify the modem state determination (no state file anymore) The statusbar probe mmcli itself. - fix the leading timer without call issue This was caused by the "pgrep -f" command that was matching itself. Using a simple "pgrep" looks good enough anyway. - fix some sxmo_statusbar update spaming issues (vol control) This one point took me a lot of time to findout a good solution. We want the USR1 kill to be spamable without causing issue to the displayed bar. We dont want mid rendered bar (half the icons). We dont want empty bars (empty stdout line). I use some variable to store pid, smart waits and a better trap function to make it to works cleanly. Now we can spam statusbarupdate. Only the last one will actually redraw the bar. Signed-off-by: Stacy Harper <contact@stacyharper.net> Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
3 years ago
printf ""
elif [ "$PCT" -lt 60 ]; then
Rework the status bar Goals of this patch : - display the signal quality I used a thermometer icon cause there is no available icon with a filleable bar o_O - display the currently used network technology (4g, 3g, etc...) I used the mapping from: https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/blob/master/include/ModemManager-enums.h#L220 Dylan also said: Anything from POTS to GPRS = 2G UMTS to EVDOB = 3G LTE = 4G 5GNR = 5G - display the modem infos when modemmonitor is disabled We want to decorelate the modem monitor from the icon. We still want to know easily if modem monitor is runing but we also want those modem infos if not. - simplify the modem state determination (no state file anymore) The statusbar probe mmcli itself. - fix the leading timer without call issue This was caused by the "pgrep -f" command that was matching itself. Using a simple "pgrep" looks good enough anyway. - fix some sxmo_statusbar update spaming issues (vol control) This one point took me a lot of time to findout a good solution. We want the USR1 kill to be spamable without causing issue to the displayed bar. We dont want mid rendered bar (half the icons). We dont want empty bars (empty stdout line). I use some variable to store pid, smart waits and a better trap function to make it to works cleanly. Now we can spam statusbarupdate. Only the last one will actually redraw the bar. Signed-off-by: Stacy Harper <contact@stacyharper.net> Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
3 years ago
printf ""
elif [ "$PCT" -lt 80 ]; then
Rework the status bar Goals of this patch : - display the signal quality I used a thermometer icon cause there is no available icon with a filleable bar o_O - display the currently used network technology (4g, 3g, etc...) I used the mapping from: https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/blob/master/include/ModemManager-enums.h#L220 Dylan also said: Anything from POTS to GPRS = 2G UMTS to EVDOB = 3G LTE = 4G 5GNR = 5G - display the modem infos when modemmonitor is disabled We want to decorelate the modem monitor from the icon. We still want to know easily if modem monitor is runing but we also want those modem infos if not. - simplify the modem state determination (no state file anymore) The statusbar probe mmcli itself. - fix the leading timer without call issue This was caused by the "pgrep -f" command that was matching itself. Using a simple "pgrep" looks good enough anyway. - fix some sxmo_statusbar update spaming issues (vol control) This one point took me a lot of time to findout a good solution. We want the USR1 kill to be spamable without causing issue to the displayed bar. We dont want mid rendered bar (half the icons). We dont want empty bars (empty stdout line). I use some variable to store pid, smart waits and a better trap function to make it to works cleanly. Now we can spam statusbarupdate. Only the last one will actually redraw the bar. Signed-off-by: Stacy Harper <contact@stacyharper.net> Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
3 years ago
printf ""
elif [ "$PCT" -lt 90 ]; then
Rework the status bar Goals of this patch : - display the signal quality I used a thermometer icon cause there is no available icon with a filleable bar o_O - display the currently used network technology (4g, 3g, etc...) I used the mapping from: https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/blob/master/include/ModemManager-enums.h#L220 Dylan also said: Anything from POTS to GPRS = 2G UMTS to EVDOB = 3G LTE = 4G 5GNR = 5G - display the modem infos when modemmonitor is disabled We want to decorelate the modem monitor from the icon. We still want to know easily if modem monitor is runing but we also want those modem infos if not. - simplify the modem state determination (no state file anymore) The statusbar probe mmcli itself. - fix the leading timer without call issue This was caused by the "pgrep -f" command that was matching itself. Using a simple "pgrep" looks good enough anyway. - fix some sxmo_statusbar update spaming issues (vol control) This one point took me a lot of time to findout a good solution. We want the USR1 kill to be spamable without causing issue to the displayed bar. We dont want mid rendered bar (half the icons). We dont want empty bars (empty stdout line). I use some variable to store pid, smart waits and a better trap function to make it to works cleanly. Now we can spam statusbarupdate. Only the last one will actually redraw the bar. Signed-off-by: Stacy Harper <contact@stacyharper.net> Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
3 years ago
printf ""
else
Rework the status bar Goals of this patch : - display the signal quality I used a thermometer icon cause there is no available icon with a filleable bar o_O - display the currently used network technology (4g, 3g, etc...) I used the mapping from: https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/blob/master/include/ModemManager-enums.h#L220 Dylan also said: Anything from POTS to GPRS = 2G UMTS to EVDOB = 3G LTE = 4G 5GNR = 5G - display the modem infos when modemmonitor is disabled We want to decorelate the modem monitor from the icon. We still want to know easily if modem monitor is runing but we also want those modem infos if not. - simplify the modem state determination (no state file anymore) The statusbar probe mmcli itself. - fix the leading timer without call issue This was caused by the "pgrep -f" command that was matching itself. Using a simple "pgrep" looks good enough anyway. - fix some sxmo_statusbar update spaming issues (vol control) This one point took me a lot of time to findout a good solution. We want the USR1 kill to be spamable without causing issue to the displayed bar. We dont want mid rendered bar (half the icons). We dont want empty bars (empty stdout line). I use some variable to store pid, smart waits and a better trap function to make it to works cleanly. Now we can spam statusbarupdate. Only the last one will actually redraw the bar. Signed-off-by: Stacy Harper <contact@stacyharper.net> Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
3 years ago
printf ""
fi
else
if [ "$PCT" -lt 10 ]; then
Rework the status bar Goals of this patch : - display the signal quality I used a thermometer icon cause there is no available icon with a filleable bar o_O - display the currently used network technology (4g, 3g, etc...) I used the mapping from: https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/blob/master/include/ModemManager-enums.h#L220 Dylan also said: Anything from POTS to GPRS = 2G UMTS to EVDOB = 3G LTE = 4G 5GNR = 5G - display the modem infos when modemmonitor is disabled We want to decorelate the modem monitor from the icon. We still want to know easily if modem monitor is runing but we also want those modem infos if not. - simplify the modem state determination (no state file anymore) The statusbar probe mmcli itself. - fix the leading timer without call issue This was caused by the "pgrep -f" command that was matching itself. Using a simple "pgrep" looks good enough anyway. - fix some sxmo_statusbar update spaming issues (vol control) This one point took me a lot of time to findout a good solution. We want the USR1 kill to be spamable without causing issue to the displayed bar. We dont want mid rendered bar (half the icons). We dont want empty bars (empty stdout line). I use some variable to store pid, smart waits and a better trap function to make it to works cleanly. Now we can spam statusbarupdate. Only the last one will actually redraw the bar. Signed-off-by: Stacy Harper <contact@stacyharper.net> Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
3 years ago
printf ""
elif [ "$PCT" -lt 20 ]; then
Rework the status bar Goals of this patch : - display the signal quality I used a thermometer icon cause there is no available icon with a filleable bar o_O - display the currently used network technology (4g, 3g, etc...) I used the mapping from: https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/blob/master/include/ModemManager-enums.h#L220 Dylan also said: Anything from POTS to GPRS = 2G UMTS to EVDOB = 3G LTE = 4G 5GNR = 5G - display the modem infos when modemmonitor is disabled We want to decorelate the modem monitor from the icon. We still want to know easily if modem monitor is runing but we also want those modem infos if not. - simplify the modem state determination (no state file anymore) The statusbar probe mmcli itself. - fix the leading timer without call issue This was caused by the "pgrep -f" command that was matching itself. Using a simple "pgrep" looks good enough anyway. - fix some sxmo_statusbar update spaming issues (vol control) This one point took me a lot of time to findout a good solution. We want the USR1 kill to be spamable without causing issue to the displayed bar. We dont want mid rendered bar (half the icons). We dont want empty bars (empty stdout line). I use some variable to store pid, smart waits and a better trap function to make it to works cleanly. Now we can spam statusbarupdate. Only the last one will actually redraw the bar. Signed-off-by: Stacy Harper <contact@stacyharper.net> Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
3 years ago
printf ""
elif [ "$PCT" -lt 30 ]; then
Rework the status bar Goals of this patch : - display the signal quality I used a thermometer icon cause there is no available icon with a filleable bar o_O - display the currently used network technology (4g, 3g, etc...) I used the mapping from: https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/blob/master/include/ModemManager-enums.h#L220 Dylan also said: Anything from POTS to GPRS = 2G UMTS to EVDOB = 3G LTE = 4G 5GNR = 5G - display the modem infos when modemmonitor is disabled We want to decorelate the modem monitor from the icon. We still want to know easily if modem monitor is runing but we also want those modem infos if not. - simplify the modem state determination (no state file anymore) The statusbar probe mmcli itself. - fix the leading timer without call issue This was caused by the "pgrep -f" command that was matching itself. Using a simple "pgrep" looks good enough anyway. - fix some sxmo_statusbar update spaming issues (vol control) This one point took me a lot of time to findout a good solution. We want the USR1 kill to be spamable without causing issue to the displayed bar. We dont want mid rendered bar (half the icons). We dont want empty bars (empty stdout line). I use some variable to store pid, smart waits and a better trap function to make it to works cleanly. Now we can spam statusbarupdate. Only the last one will actually redraw the bar. Signed-off-by: Stacy Harper <contact@stacyharper.net> Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
3 years ago
printf ""
elif [ "$PCT" -lt 40 ]; then
Rework the status bar Goals of this patch : - display the signal quality I used a thermometer icon cause there is no available icon with a filleable bar o_O - display the currently used network technology (4g, 3g, etc...) I used the mapping from: https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/blob/master/include/ModemManager-enums.h#L220 Dylan also said: Anything from POTS to GPRS = 2G UMTS to EVDOB = 3G LTE = 4G 5GNR = 5G - display the modem infos when modemmonitor is disabled We want to decorelate the modem monitor from the icon. We still want to know easily if modem monitor is runing but we also want those modem infos if not. - simplify the modem state determination (no state file anymore) The statusbar probe mmcli itself. - fix the leading timer without call issue This was caused by the "pgrep -f" command that was matching itself. Using a simple "pgrep" looks good enough anyway. - fix some sxmo_statusbar update spaming issues (vol control) This one point took me a lot of time to findout a good solution. We want the USR1 kill to be spamable without causing issue to the displayed bar. We dont want mid rendered bar (half the icons). We dont want empty bars (empty stdout line). I use some variable to store pid, smart waits and a better trap function to make it to works cleanly. Now we can spam statusbarupdate. Only the last one will actually redraw the bar. Signed-off-by: Stacy Harper <contact@stacyharper.net> Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
3 years ago
printf ""
elif [ "$PCT" -lt 50 ]; then
Rework the status bar Goals of this patch : - display the signal quality I used a thermometer icon cause there is no available icon with a filleable bar o_O - display the currently used network technology (4g, 3g, etc...) I used the mapping from: https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/blob/master/include/ModemManager-enums.h#L220 Dylan also said: Anything from POTS to GPRS = 2G UMTS to EVDOB = 3G LTE = 4G 5GNR = 5G - display the modem infos when modemmonitor is disabled We want to decorelate the modem monitor from the icon. We still want to know easily if modem monitor is runing but we also want those modem infos if not. - simplify the modem state determination (no state file anymore) The statusbar probe mmcli itself. - fix the leading timer without call issue This was caused by the "pgrep -f" command that was matching itself. Using a simple "pgrep" looks good enough anyway. - fix some sxmo_statusbar update spaming issues (vol control) This one point took me a lot of time to findout a good solution. We want the USR1 kill to be spamable without causing issue to the displayed bar. We dont want mid rendered bar (half the icons). We dont want empty bars (empty stdout line). I use some variable to store pid, smart waits and a better trap function to make it to works cleanly. Now we can spam statusbarupdate. Only the last one will actually redraw the bar. Signed-off-by: Stacy Harper <contact@stacyharper.net> Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
3 years ago
printf ""
elif [ "$PCT" -lt 60 ]; then
Rework the status bar Goals of this patch : - display the signal quality I used a thermometer icon cause there is no available icon with a filleable bar o_O - display the currently used network technology (4g, 3g, etc...) I used the mapping from: https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/blob/master/include/ModemManager-enums.h#L220 Dylan also said: Anything from POTS to GPRS = 2G UMTS to EVDOB = 3G LTE = 4G 5GNR = 5G - display the modem infos when modemmonitor is disabled We want to decorelate the modem monitor from the icon. We still want to know easily if modem monitor is runing but we also want those modem infos if not. - simplify the modem state determination (no state file anymore) The statusbar probe mmcli itself. - fix the leading timer without call issue This was caused by the "pgrep -f" command that was matching itself. Using a simple "pgrep" looks good enough anyway. - fix some sxmo_statusbar update spaming issues (vol control) This one point took me a lot of time to findout a good solution. We want the USR1 kill to be spamable without causing issue to the displayed bar. We dont want mid rendered bar (half the icons). We dont want empty bars (empty stdout line). I use some variable to store pid, smart waits and a better trap function to make it to works cleanly. Now we can spam statusbarupdate. Only the last one will actually redraw the bar. Signed-off-by: Stacy Harper <contact@stacyharper.net> Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
3 years ago
printf ""
elif [ "$PCT" -lt 70 ]; then
Rework the status bar Goals of this patch : - display the signal quality I used a thermometer icon cause there is no available icon with a filleable bar o_O - display the currently used network technology (4g, 3g, etc...) I used the mapping from: https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/blob/master/include/ModemManager-enums.h#L220 Dylan also said: Anything from POTS to GPRS = 2G UMTS to EVDOB = 3G LTE = 4G 5GNR = 5G - display the modem infos when modemmonitor is disabled We want to decorelate the modem monitor from the icon. We still want to know easily if modem monitor is runing but we also want those modem infos if not. - simplify the modem state determination (no state file anymore) The statusbar probe mmcli itself. - fix the leading timer without call issue This was caused by the "pgrep -f" command that was matching itself. Using a simple "pgrep" looks good enough anyway. - fix some sxmo_statusbar update spaming issues (vol control) This one point took me a lot of time to findout a good solution. We want the USR1 kill to be spamable without causing issue to the displayed bar. We dont want mid rendered bar (half the icons). We dont want empty bars (empty stdout line). I use some variable to store pid, smart waits and a better trap function to make it to works cleanly. Now we can spam statusbarupdate. Only the last one will actually redraw the bar. Signed-off-by: Stacy Harper <contact@stacyharper.net> Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
3 years ago
printf ""
elif [ "$PCT" -lt 80 ]; then
Rework the status bar Goals of this patch : - display the signal quality I used a thermometer icon cause there is no available icon with a filleable bar o_O - display the currently used network technology (4g, 3g, etc...) I used the mapping from: https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/blob/master/include/ModemManager-enums.h#L220 Dylan also said: Anything from POTS to GPRS = 2G UMTS to EVDOB = 3G LTE = 4G 5GNR = 5G - display the modem infos when modemmonitor is disabled We want to decorelate the modem monitor from the icon. We still want to know easily if modem monitor is runing but we also want those modem infos if not. - simplify the modem state determination (no state file anymore) The statusbar probe mmcli itself. - fix the leading timer without call issue This was caused by the "pgrep -f" command that was matching itself. Using a simple "pgrep" looks good enough anyway. - fix some sxmo_statusbar update spaming issues (vol control) This one point took me a lot of time to findout a good solution. We want the USR1 kill to be spamable without causing issue to the displayed bar. We dont want mid rendered bar (half the icons). We dont want empty bars (empty stdout line). I use some variable to store pid, smart waits and a better trap function to make it to works cleanly. Now we can spam statusbarupdate. Only the last one will actually redraw the bar. Signed-off-by: Stacy Harper <contact@stacyharper.net> Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
3 years ago
printf ""
elif [ "$PCT" -lt 90 ]; then
Rework the status bar Goals of this patch : - display the signal quality I used a thermometer icon cause there is no available icon with a filleable bar o_O - display the currently used network technology (4g, 3g, etc...) I used the mapping from: https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/blob/master/include/ModemManager-enums.h#L220 Dylan also said: Anything from POTS to GPRS = 2G UMTS to EVDOB = 3G LTE = 4G 5GNR = 5G - display the modem infos when modemmonitor is disabled We want to decorelate the modem monitor from the icon. We still want to know easily if modem monitor is runing but we also want those modem infos if not. - simplify the modem state determination (no state file anymore) The statusbar probe mmcli itself. - fix the leading timer without call issue This was caused by the "pgrep -f" command that was matching itself. Using a simple "pgrep" looks good enough anyway. - fix some sxmo_statusbar update spaming issues (vol control) This one point took me a lot of time to findout a good solution. We want the USR1 kill to be spamable without causing issue to the displayed bar. We dont want mid rendered bar (half the icons). We dont want empty bars (empty stdout line). I use some variable to store pid, smart waits and a better trap function to make it to works cleanly. Now we can spam statusbarupdate. Only the last one will actually redraw the bar. Signed-off-by: Stacy Harper <contact@stacyharper.net> Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
3 years ago
printf ""
else
Rework the status bar Goals of this patch : - display the signal quality I used a thermometer icon cause there is no available icon with a filleable bar o_O - display the currently used network technology (4g, 3g, etc...) I used the mapping from: https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/blob/master/include/ModemManager-enums.h#L220 Dylan also said: Anything from POTS to GPRS = 2G UMTS to EVDOB = 3G LTE = 4G 5GNR = 5G - display the modem infos when modemmonitor is disabled We want to decorelate the modem monitor from the icon. We still want to know easily if modem monitor is runing but we also want those modem infos if not. - simplify the modem state determination (no state file anymore) The statusbar probe mmcli itself. - fix the leading timer without call issue This was caused by the "pgrep -f" command that was matching itself. Using a simple "pgrep" looks good enough anyway. - fix some sxmo_statusbar update spaming issues (vol control) This one point took me a lot of time to findout a good solution. We want the USR1 kill to be spamable without causing issue to the displayed bar. We dont want mid rendered bar (half the icons). We dont want empty bars (empty stdout line). I use some variable to store pid, smart waits and a better trap function to make it to works cleanly. Now we can spam statusbarupdate. Only the last one will actually redraw the bar. Signed-off-by: Stacy Harper <contact@stacyharper.net> Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
3 years ago
printf ""
fi
fi
Rework the status bar Goals of this patch : - display the signal quality I used a thermometer icon cause there is no available icon with a filleable bar o_O - display the currently used network technology (4g, 3g, etc...) I used the mapping from: https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/blob/master/include/ModemManager-enums.h#L220 Dylan also said: Anything from POTS to GPRS = 2G UMTS to EVDOB = 3G LTE = 4G 5GNR = 5G - display the modem infos when modemmonitor is disabled We want to decorelate the modem monitor from the icon. We still want to know easily if modem monitor is runing but we also want those modem infos if not. - simplify the modem state determination (no state file anymore) The statusbar probe mmcli itself. - fix the leading timer without call issue This was caused by the "pgrep -f" command that was matching itself. Using a simple "pgrep" looks good enough anyway. - fix some sxmo_statusbar update spaming issues (vol control) This one point took me a lot of time to findout a good solution. We want the USR1 kill to be spamable without causing issue to the displayed bar. We dont want mid rendered bar (half the icons). We dont want empty bars (empty stdout line). I use some variable to store pid, smart waits and a better trap function to make it to works cleanly. Now we can spam statusbarupdate. Only the last one will actually redraw the bar. Signed-off-by: Stacy Harper <contact@stacyharper.net> Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
3 years ago
[ -z "$SXMO_BAR_HIDE_BAT_PER" ] && printf " %s%%" "$PCT"
printf " "
# Volume
AUDIODEV="$(sxmo_audiocurrentdevice.sh)"
Rework the status bar Goals of this patch : - display the signal quality I used a thermometer icon cause there is no available icon with a filleable bar o_O - display the currently used network technology (4g, 3g, etc...) I used the mapping from: https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/blob/master/include/ModemManager-enums.h#L220 Dylan also said: Anything from POTS to GPRS = 2G UMTS to EVDOB = 3G LTE = 4G 5GNR = 5G - display the modem infos when modemmonitor is disabled We want to decorelate the modem monitor from the icon. We still want to know easily if modem monitor is runing but we also want those modem infos if not. - simplify the modem state determination (no state file anymore) The statusbar probe mmcli itself. - fix the leading timer without call issue This was caused by the "pgrep -f" command that was matching itself. Using a simple "pgrep" looks good enough anyway. - fix some sxmo_statusbar update spaming issues (vol control) This one point took me a lot of time to findout a good solution. We want the USR1 kill to be spamable without causing issue to the displayed bar. We dont want mid rendered bar (half the icons). We dont want empty bars (empty stdout line). I use some variable to store pid, smart waits and a better trap function to make it to works cleanly. Now we can spam statusbarupdate. Only the last one will actually redraw the bar. Signed-off-by: Stacy Harper <contact@stacyharper.net> Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
3 years ago
AUDIOSYMBOL="$(printf %s "$AUDIODEV" | cut -c1)"
if [ "$AUDIOSYMBOL" = "L" ] || [ "$AUDIOSYMBOL" = "N" ]; then
Rework the status bar Goals of this patch : - display the signal quality I used a thermometer icon cause there is no available icon with a filleable bar o_O - display the currently used network technology (4g, 3g, etc...) I used the mapping from: https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/blob/master/include/ModemManager-enums.h#L220 Dylan also said: Anything from POTS to GPRS = 2G UMTS to EVDOB = 3G LTE = 4G 5GNR = 5G - display the modem infos when modemmonitor is disabled We want to decorelate the modem monitor from the icon. We still want to know easily if modem monitor is runing but we also want those modem infos if not. - simplify the modem state determination (no state file anymore) The statusbar probe mmcli itself. - fix the leading timer without call issue This was caused by the "pgrep -f" command that was matching itself. Using a simple "pgrep" looks good enough anyway. - fix some sxmo_statusbar update spaming issues (vol control) This one point took me a lot of time to findout a good solution. We want the USR1 kill to be spamable without causing issue to the displayed bar. We dont want mid rendered bar (half the icons). We dont want empty bars (empty stdout line). I use some variable to store pid, smart waits and a better trap function to make it to works cleanly. Now we can spam statusbarupdate. Only the last one will actually redraw the bar. Signed-off-by: Stacy Harper <contact@stacyharper.net> Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
3 years ago
printf "" #speakers or none, use no special symbol
elif [ "$AUDIOSYMBOL" = "H" ]; then
Rework the status bar Goals of this patch : - display the signal quality I used a thermometer icon cause there is no available icon with a filleable bar o_O - display the currently used network technology (4g, 3g, etc...) I used the mapping from: https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/blob/master/include/ModemManager-enums.h#L220 Dylan also said: Anything from POTS to GPRS = 2G UMTS to EVDOB = 3G LTE = 4G 5GNR = 5G - display the modem infos when modemmonitor is disabled We want to decorelate the modem monitor from the icon. We still want to know easily if modem monitor is runing but we also want those modem infos if not. - simplify the modem state determination (no state file anymore) The statusbar probe mmcli itself. - fix the leading timer without call issue This was caused by the "pgrep -f" command that was matching itself. Using a simple "pgrep" looks good enough anyway. - fix some sxmo_statusbar update spaming issues (vol control) This one point took me a lot of time to findout a good solution. We want the USR1 kill to be spamable without causing issue to the displayed bar. We dont want mid rendered bar (half the icons). We dont want empty bars (empty stdout line). I use some variable to store pid, smart waits and a better trap function to make it to works cleanly. Now we can spam statusbarupdate. Only the last one will actually redraw the bar. Signed-off-by: Stacy Harper <contact@stacyharper.net> Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
3 years ago
printf " "
elif [ "$AUDIOSYMBOL" = "E" ]; then
Rework the status bar Goals of this patch : - display the signal quality I used a thermometer icon cause there is no available icon with a filleable bar o_O - display the currently used network technology (4g, 3g, etc...) I used the mapping from: https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/blob/master/include/ModemManager-enums.h#L220 Dylan also said: Anything from POTS to GPRS = 2G UMTS to EVDOB = 3G LTE = 4G 5GNR = 5G - display the modem infos when modemmonitor is disabled We want to decorelate the modem monitor from the icon. We still want to know easily if modem monitor is runing but we also want those modem infos if not. - simplify the modem state determination (no state file anymore) The statusbar probe mmcli itself. - fix the leading timer without call issue This was caused by the "pgrep -f" command that was matching itself. Using a simple "pgrep" looks good enough anyway. - fix some sxmo_statusbar update spaming issues (vol control) This one point took me a lot of time to findout a good solution. We want the USR1 kill to be spamable without causing issue to the displayed bar. We dont want mid rendered bar (half the icons). We dont want empty bars (empty stdout line). I use some variable to store pid, smart waits and a better trap function to make it to works cleanly. Now we can spam statusbarupdate. Only the last one will actually redraw the bar. Signed-off-by: Stacy Harper <contact@stacyharper.net> Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
3 years ago
printf " " #earpiece
fi
VOL=0
[ "$AUDIODEV" = "None" ] || VOL="$(
amixer sget "$AUDIODEV" |
grep -oE '([0-9]+)%' |
tr -d ' %' |
awk '{ s += $1; c++ } END { print s/c }' |
xargs printf %.0f
)"
if [ "$AUDIODEV" != "None" ]; then
Rework the status bar Goals of this patch : - display the signal quality I used a thermometer icon cause there is no available icon with a filleable bar o_O - display the currently used network technology (4g, 3g, etc...) I used the mapping from: https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/blob/master/include/ModemManager-enums.h#L220 Dylan also said: Anything from POTS to GPRS = 2G UMTS to EVDOB = 3G LTE = 4G 5GNR = 5G - display the modem infos when modemmonitor is disabled We want to decorelate the modem monitor from the icon. We still want to know easily if modem monitor is runing but we also want those modem infos if not. - simplify the modem state determination (no state file anymore) The statusbar probe mmcli itself. - fix the leading timer without call issue This was caused by the "pgrep -f" command that was matching itself. Using a simple "pgrep" looks good enough anyway. - fix some sxmo_statusbar update spaming issues (vol control) This one point took me a lot of time to findout a good solution. We want the USR1 kill to be spamable without causing issue to the displayed bar. We dont want mid rendered bar (half the icons). We dont want empty bars (empty stdout line). I use some variable to store pid, smart waits and a better trap function to make it to works cleanly. Now we can spam statusbarupdate. Only the last one will actually redraw the bar. Signed-off-by: Stacy Harper <contact@stacyharper.net> Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
3 years ago
if [ "$VOL" -gt 66 ]; then
printf ""
elif [ "$VOL" -gt 33 ]; then
printf ""
elif [ "$VOL" -gt 0 ]; then
printf ""
elif [ "$VOL" -eq 0 ]; then
printf "ﱝ"
fi
fi
Rework the status bar Goals of this patch : - display the signal quality I used a thermometer icon cause there is no available icon with a filleable bar o_O - display the currently used network technology (4g, 3g, etc...) I used the mapping from: https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/blob/master/include/ModemManager-enums.h#L220 Dylan also said: Anything from POTS to GPRS = 2G UMTS to EVDOB = 3G LTE = 4G 5GNR = 5G - display the modem infos when modemmonitor is disabled We want to decorelate the modem monitor from the icon. We still want to know easily if modem monitor is runing but we also want those modem infos if not. - simplify the modem state determination (no state file anymore) The statusbar probe mmcli itself. - fix the leading timer without call issue This was caused by the "pgrep -f" command that was matching itself. Using a simple "pgrep" looks good enough anyway. - fix some sxmo_statusbar update spaming issues (vol control) This one point took me a lot of time to findout a good solution. We want the USR1 kill to be spamable without causing issue to the displayed bar. We dont want mid rendered bar (half the icons). We dont want empty bars (empty stdout line). I use some variable to store pid, smart waits and a better trap function to make it to works cleanly. Now we can spam statusbarupdate. Only the last one will actually redraw the bar. Signed-off-by: Stacy Harper <contact@stacyharper.net> Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
3 years ago
printf " %s\0" "$(date +%R)"
}
Rework the status bar Goals of this patch : - display the signal quality I used a thermometer icon cause there is no available icon with a filleable bar o_O - display the currently used network technology (4g, 3g, etc...) I used the mapping from: https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/blob/master/include/ModemManager-enums.h#L220 Dylan also said: Anything from POTS to GPRS = 2G UMTS to EVDOB = 3G LTE = 4G 5GNR = 5G - display the modem infos when modemmonitor is disabled We want to decorelate the modem monitor from the icon. We still want to know easily if modem monitor is runing but we also want those modem infos if not. - simplify the modem state determination (no state file anymore) The statusbar probe mmcli itself. - fix the leading timer without call issue This was caused by the "pgrep -f" command that was matching itself. Using a simple "pgrep" looks good enough anyway. - fix some sxmo_statusbar update spaming issues (vol control) This one point took me a lot of time to findout a good solution. We want the USR1 kill to be spamable without causing issue to the displayed bar. We dont want mid rendered bar (half the icons). We dont want empty bars (empty stdout line). I use some variable to store pid, smart waits and a better trap function to make it to works cleanly. Now we can spam statusbarupdate. Only the last one will actually redraw the bar. Signed-off-by: Stacy Harper <contact@stacyharper.net> Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
3 years ago
WM="$(sxmo_wm.sh)"
forceupdate() {
kill "$SLEEPID"
}
Rework the status bar Goals of this patch : - display the signal quality I used a thermometer icon cause there is no available icon with a filleable bar o_O - display the currently used network technology (4g, 3g, etc...) I used the mapping from: https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/blob/master/include/ModemManager-enums.h#L220 Dylan also said: Anything from POTS to GPRS = 2G UMTS to EVDOB = 3G LTE = 4G 5GNR = 5G - display the modem infos when modemmonitor is disabled We want to decorelate the modem monitor from the icon. We still want to know easily if modem monitor is runing but we also want those modem infos if not. - simplify the modem state determination (no state file anymore) The statusbar probe mmcli itself. - fix the leading timer without call issue This was caused by the "pgrep -f" command that was matching itself. Using a simple "pgrep" looks good enough anyway. - fix some sxmo_statusbar update spaming issues (vol control) This one point took me a lot of time to findout a good solution. We want the USR1 kill to be spamable without causing issue to the displayed bar. We dont want mid rendered bar (half the icons). We dont want empty bars (empty stdout line). I use some variable to store pid, smart waits and a better trap function to make it to works cleanly. Now we can spam statusbarupdate. Only the last one will actually redraw the bar. Signed-off-by: Stacy Harper <contact@stacyharper.net> Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
3 years ago
trap "forceupdate" USR1
Rework the status bar Goals of this patch : - display the signal quality I used a thermometer icon cause there is no available icon with a filleable bar o_O - display the currently used network technology (4g, 3g, etc...) I used the mapping from: https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/blob/master/include/ModemManager-enums.h#L220 Dylan also said: Anything from POTS to GPRS = 2G UMTS to EVDOB = 3G LTE = 4G 5GNR = 5G - display the modem infos when modemmonitor is disabled We want to decorelate the modem monitor from the icon. We still want to know easily if modem monitor is runing but we also want those modem infos if not. - simplify the modem state determination (no state file anymore) The statusbar probe mmcli itself. - fix the leading timer without call issue This was caused by the "pgrep -f" command that was matching itself. Using a simple "pgrep" looks good enough anyway. - fix some sxmo_statusbar update spaming issues (vol control) This one point took me a lot of time to findout a good solution. We want the USR1 kill to be spamable without causing issue to the displayed bar. We dont want mid rendered bar (half the icons). We dont want empty bars (empty stdout line). I use some variable to store pid, smart waits and a better trap function to make it to works cleanly. Now we can spam statusbarupdate. Only the last one will actually redraw the bar. Signed-off-by: Stacy Harper <contact@stacyharper.net> Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
3 years ago
update() {
BAR="$(bar)"
[ -z "$SLEEPID" ] && return # to prevent mid rendering interuption
printf %s "$BAR" | case "$WM" in
sway|ssh) xargs -0 printf "%s\n";;
dwm) xargs -0 xsetroot -name;;
esac
}
5 years ago
while :
do
Rework the status bar Goals of this patch : - display the signal quality I used a thermometer icon cause there is no available icon with a filleable bar o_O - display the currently used network technology (4g, 3g, etc...) I used the mapping from: https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/blob/master/include/ModemManager-enums.h#L220 Dylan also said: Anything from POTS to GPRS = 2G UMTS to EVDOB = 3G LTE = 4G 5GNR = 5G - display the modem infos when modemmonitor is disabled We want to decorelate the modem monitor from the icon. We still want to know easily if modem monitor is runing but we also want those modem infos if not. - simplify the modem state determination (no state file anymore) The statusbar probe mmcli itself. - fix the leading timer without call issue This was caused by the "pgrep -f" command that was matching itself. Using a simple "pgrep" looks good enough anyway. - fix some sxmo_statusbar update spaming issues (vol control) This one point took me a lot of time to findout a good solution. We want the USR1 kill to be spamable without causing issue to the displayed bar. We dont want mid rendered bar (half the icons). We dont want empty bars (empty stdout line). I use some variable to store pid, smart waits and a better trap function to make it to works cleanly. Now we can spam statusbarupdate. Only the last one will actually redraw the bar. Signed-off-by: Stacy Harper <contact@stacyharper.net> Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
3 years ago
sleep 10 &
SLEEPID=$!
update &
UPDATEID=$!
wait "$SLEEPID"
unset SLEEPID
wait "$UPDATEID"
done