The idea behind this title is to use XTerm as a log viewer over the desktop, just like root-tail works. The tool root-tail paints text on the root window by default or any other XWindow when used with the
Using XTerm comes with little advantage, it is possible to scroll into the “backlog” and make text selections. On a downside, it won't let you click through into the desktop, therefore it is rather useful for people without desktop icons for example.
We will proceed with a first simple example, by writing a Shell script that will use the combo DevilsPie and XTerm. The terminals will all be kept in the background below other windows and never take the focus thanks to DevilsPie. DevilsPie is a tool watching the creation of new windows and applies special rules over them.
Obviously, you need to install the command line tool
devilspie. It's a command to run in the background as a daemon. Configuration files with a
.ds extensions contain matches for windows and rules that are put within the
The first example shows how to match only one specific XTerm window.
The DevilsPie configuration:
(if (is (window_class) "DesktopLog") (begin (wintype "dock") (geometry "+20+45") (below) (undecorate) (skip_pager) (opacity 80) ) )
The Shell script making sure
devilspie is running, and spawning a single
#!/bin/sh test `pidof devilspie` || devilspie & xterm -geometry 164x73 -uc -class DesktopLog -T daemon.log -e sudo tail -f /var/log/daemon.log &
NB: You can notice the size of the XTerm window is set through the Shell script while the position is set through the DevilsPie rules file, and there is a simple reason for this. By default XTerm has a size of 80 columns and 24 lines and text with too long lines will be wrapped on the next line. If afterwards you resize the window the wrapped text won't move up and the result will be ugly. Therefore it's better to set the initial size of the terminal correctly.
To try the example, save the DevilsPie snippet inside the directory
~/.devilspie, and download and execute the Shell script. Make sure to quit any previous DevilsPie process whenever you modify or install a new
The second example is a little more complete, it starts three terminals of which one is coloured in black.
(if (matches (window_class) "DesktopLog[0-9]+") (begin (wintype "dock") (below) (undecorate) (skip_pager) (opacity 80) ) ) (if (is (window_class) "DesktopLog1") (geometry "+480+20") ) (if (is (window_class) "DesktopLog2") (geometry "+20+20") ) (if (is (window_class) "DesktopLog3") (geometry "+20+330") )
#!/bin/sh test `pidof devilspie` || devilspie & xterm -geometry 88x40 -uc -class DesktopLog1 -T daemon.log -e sudo -s tail -f /var/log/daemon.log & xterm -geometry 70x20 -uc -class DesktopLog2 -T auth.log -e sudo -s tail -f /var/log/auth.log & xterm -fg grey -bg black -geometry 70x16 -uc -class DesktopLog3 -T pacman.log -e sudo -s tail -f /var/log/pacman.log &
NB: You will probably notice that setting the geometry is awkward, specially since position and size are in two different files, getting it right needs several tweakings.