Allow only one instance of the application running

Issue #159 closed
Former user created an issue

Originally reported on Google Code with ID 159

reported to me by Marcel Spitau, marcel.spitau <at> lug-balista <dot> de

user request: Marcel uses a hot key to start SpeedCrunch. Each time 
SpeedCrunch looses the focus, it minimizes to the tray. Pressing the hot 
key a second time then, unfortunately, always launches a new instance. 
Marcel would like to see SpeedCrunch checking on launch whether there is 
already an instance open, and bring the opened instance to the focus of 
the user then.

Remarks by me: A user might want to open more than one instance, for 
instance, when she wants to compare two results. So she should be able to 
switch off this enhancement.
There is a script circling around, that does exactly what Marcel wants:
See here: http://www.furl.net/item/30725860, or, slightly modified, here:

#!/bin/bash
# If speedcrunch is not running, start it; otherwise bring the window to
# my focus
calcwin=`wmctrl -l | grep -w -m 1 -o "SpeedCrunch"`
if [ $calcwin ]; then wmctrl -F -R SpeedCrunch else speedcrunch & fi 

Reported by wolf.lammen on 2008-03-04 23:50:27

Comments (12)

  1. Former user Account Deleted

    ``` At least with me, it doesn't happen when the focus is lost, but when the user switches to another virtual screen (KDE). It is the very same issul or have we got a different one here?

    I haven't tried the script, but assuming it works, IMO it is not the best solution since it requires wmctrl to be installed, which doesn't happen by default on my Kubuntu box, for instance.

    What we also can do is to allow the user to create new display tabs, thus solving the problem of multiple issues. The tabs can even be dock widgets, so that they can be put floating somewhere else (just an idea, not sure if a good one). ```

    Reported by `helder.pereira.correia` on 2008-03-05 10:57:18

  2. Former user Account Deleted

    ``` It's not about the minimizing, which Marcel finds to be a nice feature, it is about

    having a simple option at hand: If speedcrunch is not running, start it; otherwise bring the window to my focus. Marcel says, Krusader does something similar. And the script works as expected.

    ```

    Reported by `wolf.lammen` on 2008-03-05 12:08:14

  3. Former user Account Deleted

    ``` For a true cross-platform and decent solution, something like Qt commercial solution QtSingleApplication must be used. There is a similar free implementation from Qxt that we should take a further look: http://docs.libqxt.org/classQxtWindowSystem.html ```

    Reported by `helder.pereira.correia` on 2008-03-11 15:15:52

  4. Former user Account Deleted

    ``` Issue 303 has been merged into this issue. ```

    Reported by `helder.pereira.correia` on 2009-08-10 10:49:20

  5. Former user Account Deleted

    ``` Issue 363 has been merged into this issue. ```

    Reported by `helder.pereira.correia` on 2010-11-09 06:12:27

  6. Log in to comment