diff --git a/.config/qtile/checkUpdates.sh b/.config/qtile/checkUpdates.sh new file mode 100755 index 0000000..eb792f0 --- /dev/null +++ b/.config/qtile/checkUpdates.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +# Check updates on Arch Linux +# Note: Create cron on /etc/cron.d/checkupdates with the following lines: +# 0 * * * * root /usr/bin/pacman -Sy +# 30 * * * * root /usr/bin/pacman -Sy +if [ -f /usr/bin/pacman ] ; then + num_packages=$(pacman -Qu | wc -l) + echo "${num_packages}" + +# Check updates on Ubuntu/Debian/Devuan +# Note: Create cron on /etc/cron.d/checkupdates with the following lines: +# 0 * * * * root /usr/bin/aptitude update +# 30 * * * * root /usr/bin/aptitude update +elif [ -f /usr/bin/aptitude ] ; then + num_packages=$(aptitude search "~U" | wc -l) + echo "${num_packages}" + +# Disable for other distros +else + echo "0" +fi diff --git a/.config/qtile/settings/widgets.py b/.config/qtile/settings/widgets.py index 5f5d887..13063c0 100644 --- a/.config/qtile/settings/widgets.py +++ b/.config/qtile/settings/widgets.py @@ -9,11 +9,9 @@ def base(fg='text', bg='dark'): 'background': colors[bg] } - def separator(): return widget.Sep(**base(), linewidth=0, padding=5) - def icon(fg='text', bg='dark', fontsize=16, text="?"): return widget.TextBox( **base(fg, bg), @@ -78,7 +76,8 @@ primary_widgets = [ no_update_string='0', display_format='{updates}', update_interval=1800, - custom_command='checkupdates', + #custom_command='checkupdates', + custom_command='bash ~/.config/qtile/checkUpdates.sh', ), powerline('color3', 'color5'),