>I am trying to write a shell script to only allow a single instance of
>PINE to run under X (with windowmaker 0.64).
>What I am trying to do is force a existing instance of PINE to the
>forground from a script in a different shell session. And this is the
>problem, how do I force this process to the forground? I can get the
>process ID with no problems.
>BTW. I am using bash.
Few things you have to realize:
1) This really isn't that shell dependent.
2) The bash/pine in question doesn't know it's being run from X, it
has nothing to do with X. An xterm (or a work-a-like) gives bash, pine
an interface that works just like a normal terminal.
What you probably want to do, is replace the command with which you
start pine with a script that checks if you're running X (this can be
done by either checking the DISPLAY environment variable or seeing if
TERM is something like 'xterm'* or 'rxvt'. The last option is probably
the neatest, considering what I'm going to suggest). Then if you are
in fact running under X, you use the xsetfocus[1] utility to set the
focus to a window named 'pine'. If this fails (see the exit status of
xsetfocus), set the X-term title to 'pine' (check the Bash-prompt howto
for how to do this). If xsetfocus doesn't fail, the focus is now on
the pine, and you can exit the shell script.
[1] Xsetfocus is a small util I've written (http://www.var.cx/utils/xsetfocus.c)
(I still can't believe there's nothing like this that comes with XFree,
I've probably just missed it. But for the time being, this works).
--
Frank v Waveren Fingerprint: 0EDB 8787