How to have Gnu Screen display number of updates for Arch linux

Archlinux-icon.png

1.   sudo vim /etc/cron.hourly/pacmansy

2.  and place this within

pacman -Sy

3.  then :wq the file and make it executable:

chmod a+x /etc/cron.hourly/pacmansy

4.   vim ~/bin/getupdates.pl

and place this within:

#!/usr/bin/perl
use strict;
use warnings;
print ((`pacman -Qu` =~ m/^[^\s]+\s\((\d+)\):/m) ? $1 : 0);

5.  vim ~/.screenrc and do this:  (relevant parts are bolded)

caption always “%{= KW}%-w%{= Gk}%n %t%{-}%+w %-=”

hardstatus alwayslastline “%{= kW} %-= %{= kC}Session:%u%{= kW} %5` | %{= kC}Host:%{= kW} %H | %1` |%{= kC} MEM:%{= kW} %2`MB /%{= kC} SW: %{= kW}%3`MB | %{= kC}Unread %{= kW}%4` | %{kC}Updates:%{kW} %7` | %m/%d %c”
#Backticks to display information in status bar
backtick 1 60 60 /home/username/bin/get_uptime
backtick 2 60 60 /home/username/bin/get_freemem
backtick 3 60 60 /home/username/bin/get_freeswap
backtick 4 60 60 /home/username/bin/get_gmail
backtick 5 60 60 /home/username/bin/get_sessionname
backtick 7 60 60 perl /home/username/bin/get_updates.pl

Now run screen and the number of updates awaiting for you in pacman should be displayed.  Enjoy.

Related Posts

Comments are closed.