temporary (TM) solution to display the number of pending update

This commit is contained in:
histausse 2022-02-05 00:45:32 +01:00
parent f3d28f90eb
commit 8a7f336032
Signed by: histausse
GPG key ID: 67486F107F62E9E9
3 changed files with 31 additions and 1 deletions

29
.config/i3/bar.sh Executable file
View file

@ -0,0 +1,29 @@
#!/bin/sh
/usr/local/bin/i3status | while :
do
read line
if echo "${line}" | grep -Pq '^\{"version":\d\}$' ; then
echo $line
elif echo "${line}" | grep -Pq '^\[$' ; then
echo $line
else
echo -n "["
line=`echo "${line}" | sed 's/^,\{0,1\}\[//' | sed 's/\]$//'`
NB_UPDATES=`/sbin/checkupdates | /sbin/wc -l`
NB_UPDATES_COLOR="#40AA40"
if [ $NB_UPDATES -ge 10 ] ; then
NB_UPDATES_COLOR="#FF8C00"
elif [ $NB_UPDATES -ge 25 ] ; then
NB_UPDATES_COLOR="#FF0000"
fi
echo -n "{"
echo -n "\"name\":\"updates\","
echo -n "\"full_text\":\"pending updates: ${NB_UPDATES} \","
echo -n "\"color\":\"${NB_UPDATES_COLOR}\","
echo -n "\"markup\":\"pango\""
echo -n "},"
echo "$line]" || exit 1
echo -n ","
fi
done

View file

@ -203,7 +203,7 @@ bindsym $mod+r mode "resize"
# finds out, if available) # finds out, if available)
bar { bar {
tray_output primary tray_output primary
status_command /usr/local/bin/i3status status_command "sh ~/.config/i3/bar.sh"
position top position top
separator_symbol " | " separator_symbol " | "
colors { colors {

View file

@ -7,6 +7,7 @@
# If the above line is not correctly displayed, fix your editor first! # If the above line is not correctly displayed, fix your editor first!
general { general {
output_format = "i3bar"
colors = true colors = true
interval = 5 interval = 5
color_good = "#40AA40" color_good = "#40AA40"