[BL] RXVT popups (and chroot)
lforrestster at gmail.com
Sat Feb 10 00:17:56 EST 2007
Finally took the time to figure this out. How to create a new
window of the right size and position it and run a command in
it and have the window stay up indefinitely after the command
has run, without a prompt or cursor visible, with the message
displayed in bold.
Here's an example, creating a small window that notifies the user
that he/she needs to change CDs, at top right center, with the
title "CD Drive 1", that will stay up until deliberately killed:
rxvt -g 30X6-120+140 -cr white -title "CD Drive 1" +sb -e /bin/sh -s -c "PS1='';echo -e \"\033[2;5H\033[1m REMOVE DISK ONE\n\n THEN INSERT DISK TWO\""
The "-cr white" creates a white cursor and the background is white...
"PS1=''" unsets the prompt for this shell.
"-e /bin/sh -s -c" calls a shell that runs the command(s) after c
and then stays up to take input from standard in.
"\033[3;5H" sets the cursor 2 lines down and 5 columns over.
"\033[1m" makes the letters bold.
This will create a full-size window (on my system, found with
'stty size') and run a login shell and ls and the window will
rxvt -g 106X35 -title "X" +sb -C -e /bin/sh -s -c ". /etc/profile;ls -Fs"
"+sb" leaves off the scrollbar (Shift-PageUp/PageDown works good).
The ". /etc/profile" tells the shell to read that file, giving
you a login environment.
That's handy, because it lets you bring up windows at boot that
are running an app (even if it just 'ls') that will _stay_ up
after you are done with the app. If you just use '-e command' the
window will die when the app is over. If it's something like 'ls'
the window will just flicker on the screen and be gone.
Of course, sometimes you _want_ windows to die with with the apps
they were created with.
If you mess around with the ANSI escapes (echo -e \033[*) on
the commandline and you want to set your exterm/console back to
echo -e "\033[0m"
:-) You'll see why I included that.
This may be necessary too:
I tried 'wall', but it doesn't work at all with rxvt.
Just as an aside, if you are chrooting to another, mounted (and
similar) OS, the top directory, this will give you a login shell
chroot /dir /bin/sh -s -c ". /etc/profile"
'exit' to get out. :-)
Favorite fiction book of the year:
"Ingathering" Zenna Henderson
More information about the BasLinux