run or raise?

Memnon Anon <gegendosenfleisch-gM/[email protected]>
Newsgroups gmane.comp.window-managers.ratpoison.devel
Message-ID <[email protected]>
Hi,

I have been testing stumpwm for a couple of days; I liked it very much,
but I found myself using the advantages not extensively enough to run a
full blown lisp on my 512mb notebook.

Now, back at ratpoison, there was one feature I really missed: the
run-or-raise command.

Searching google and gmane, I found no solution out there, so
I made a very simple bash script: rp-run-or-raise.sh

--8<---------------cut here---------------start------------->8---
#!/bin/bash
# emulate stumpwms run-or-raise with ratpoison
# Param1: Windowname to look for
# Param2: Command to start if not present yet

ratpoison -c windows|grep -q $1

if [ $? -eq 0 ] ; then
#    echo "Value grep: $? . selecting"
    ratpoison -c "select $1"
else
#    echo "Value grep: $? . starting"
    $2&
fi
--8<---------------cut here---------------end--------------->8---

and now have this in my .ratpoisonrc:

,----
| set winname class
| bind c exec rp-run-or-raise.sh URxvt 'urxvt'
| bind e exec rp-run-or-raise.sh Emacs 'emacsclient -c'
| bind x exec rp-run-or-raise.sh Conkeror "conkeror"
`----

And it works afaics.

Any suggestions for improvements are very welcome.

Memnon
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.