[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openbox
Subject:    [openbox] Preventing multiple instances of a program running?
From:       andreas.fink85 () googlemail ! com (Andreas Fink)
Date:       2011-02-09 9:06:02
Message-ID: 20110209100602.42a04ba3 () jocker-laptop
[Download RAW message or body]

On Wed, 9 Feb 2011 16:53:28 +0800
fwoncn <fw.oncn at gmail.com> wrote:

> Hi everybody,
> I sometimes got too much roxterm instances open and confused, so I'd love to
> prevent multiple instances of a certain program running. I've studied
> openbox's RC file and am now convinced that my request has nothing to do
> with a window manager, but I still wanna try this mailing list, to see if
> anyone can help.
> 
> Thanks

I think there are a million ways for solving your problem. It depends on what exactly \
you want to achieve. If I were you, I would write a shell-script to check for running \
roxterm instances, and if there are already enough instances switch to one, instead \
of starting a new one.

Simple example (you probably need to change it to your needs):
#!/bin/bash

ROX_INSTANCES=$(pgrep roxterm | wc -l)

if [[ ROX_INSTANCES -gt 5 ]]; then
  # we have more than 5 instances already open, so switch to the first found
  wmctrl -a "roxterm" # roxterm is the window title, I have no idea, how the real \
window title of a rox term is ;) else
  roxterm
fi
######## End of example ###########

It really depends what you want to achieve. For me wmctrl sometimes does not work, so \
I use wmiface instead sometimes.

If you clarify your request a bit further, i.e. what do you mean by too many \
instances, what do you expect to happen, etc I could help a bit more ;)

Regards
Andreas


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic