Linux for Users: Animation with X Window System Icons
The two programs here, "iclock," and, "ibanner," are simple, and, hopefully, useful programs that demonstrate how displaying animation on Linux desktops is as easy as accomplishing the same tasks on Windows or Macintosh displays.
Linux desktops are actually capable of displaying fantastic, animated graphics. The main difficulty, as usual, is that Linux and the the X Window System provide so many options that it's difficult for beginners to navigage through all of the programs and libraries needed to accomplish any task.
Displaying anything using Linux is often complicated by the fact that a machine can use any of several different desktops. The programs here, which you can download from the links below, can work with desktops that use pixmaps for icons, like Motif's, "mwm," as well as desktops with task bars that use mini-icons, like, "nautilus," and, "xfce," and desktops that don't use graphical icons on their taskbars, like, "fvwm."
However, the basic technique is the same: the programs continuously update the icon's graphics, and notify the desktop program of the change. Because many window managers display the window's title as the icon title, the program updates the window's title also. However, because these programs display only icons, the actual windows do not need to be made visible, and the programs tell the desktop software to display only the title and the icon image on the screen.
As usual, "iclock," and, "ibanner," are self contained. They require only the basic Xlib libraries and headers. After downloading and unzipping the files from the source code below, you can build and install them with a few commands.
$ make $ su # Enter the superuser password. # make install
After that, you can display each program's options by typing, "iclock -h," or, "ibanner -h," at the shell prompt.
The, "iclock," options are relatively simple. On a desktop that uses graphical icons, the options allow you to display either a digital or analog clock. The program also updates the icon label with the date and time, and so it provides continuous updates on systems that use text in the task bar.
The options for, "ibanner," are a little more complicated, because, "ibanner," allows you to update the text in an icon that is already on the screen. Here are a few examples.
# To start displaying a banner icon. $ ibanner -t "This is the icon's title." -e "This is the text." # To display a banner icon that you want to update, use the # -v option. Ibanner prints its process id, which you can use # to update the text later. You can also find the process id # using, "ps." $ ibanner -v -t "Title" -e "Text in the icon." 3485 ... # Then, to update the banner text, give the process id of the # banner as an argument with, "-c." $ ibanner -c 3485 -e "New text that you want to display."
That makes, "ibanner," useful for all sorts of system monitoring tasks. One of the oldest is monitoring your system's mail directory for new mail. These programs are commonly known as, "biffs," probably after someone's name in the early days of UNIX networking when people began sending e-mail messages to each other. So here's a shell script that uses, "ibanner," as a biff. You can call the script, "ibiff," or something similar, and keep it in a convenient place. (Note that the local mail directory does not include any messages you send and receive using a Web browser.)
#!/bin/bash
# Change if the mail spool directory on your
# machine is different.
MAILDIR=/var/spool/mail
MAILSIZE_INIT=`ls -l $MAILDIR/$LOGNAME | awk '{print $5; }'`
if [ $MAILSIZE_INIT -gt "0" ] ; then
ibanner -v -t Mail -e "You have mail." > /tmp/ibiff.pid &
else
ibanner -v -t Mail -e "No mail." > /tmp/ibiff.pid &
fi
PID=`cat /tmp/ibiff.pid`
rm -f /tmp/ibiff.pid
while [ true ]; do
MAILSIZE_NEW=`ls -l $MAILDIR/$LOGNAME | awk '{print $5; }'`
if [ $MAILSIZE_NEW -gt $MAILSIZE_INIT ]; then
ibanner -c $PID -e "You have new mail."
MAILSIZE_INIT=$MAILSIZE_NEW
elif [ $MAILSIZE_NEW -eq "0" ]; then
ibanner -c $PID -e "No mail."
MAILSIZE_INIT=$MAILSIZE_NEW
fi
sleep 3
done
Download Ibanner
- http://sites.google.com/site/unixb4coffee/home/ibanner-1.1.zip
Click here to download ibanner 1.1.
Download Iclock
- http://sites.google.com/site/unixb4coffee/home/iclock-1.0.zip
Click here to download iclock 1.0.
This Hub was last updated on January 12, 2012
Follow (1)Comments 3 comments
The original biff program was named after the programmer's dog, because it would always bark when the mailman showed up. This fact brought to you by the 1980's.
10+ Free Awesome Programs to Download For Your PC
How to Download and Install Multiple Software Programs All At Once on Your PC
10 More Free, Awesome Programs to Download For Your PC
FREE Office Suite Program Download
How to Download Files with Torrent Software like Bit Torrent or uTorrent
Malware Protection Programs
How to use Revo Uninstaller to Uninstall Programs from your Computer?
How To: Speed up torrents to download up to 2x faster!
blag 16 months ago
I've always thought that X should have tons of really small snippets of code or tiny static libraries that let you set these things up on your own to minimize the duplication of coding simple things with X.
Also, do you think you could get a more up-to-date screenshot using a Qt or GTK+ application? It's kind of ironic to be extolling the usefulness of X when your screenshot is of the Motif toolkit and Emacs. I suppose you'd need more than the standard X libraries then.