Allow only one instance of the application running
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)
-
Account Deleted -
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
-
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
-
Account Deleted ``` I just found this out. Maybe we can give it a try to solve this issue: http://www.qt-apps.org/content/show.php/SingleApplication?content=81163 ```
Reported by `helder.pereira.correia` on 2008-05-18 22:42:40
-
Account Deleted ``` http://docs.libqxt.org/classQxtSemaphore.html ```
Reported by `helder.pereira.correia` on 2008-07-03 22:56:49
-
Account Deleted ``` Note to myself: this is the way to go http://wiki.qtcentre.org/index.php?title=SingleApplication. I believe we now should introduce tabs or something similar together with single instance, so the user can have separate "consoles". ```
Reported by `helder.pereira.correia` on 2008-09-11 08:43:44 - Status changed: `Accepted` - Labels added: Milestone-0.11
-
Account Deleted Reported by `helder.pereira.correia` on 2008-12-08 22:58:32
-
Account Deleted ``` Implemented in commit 2320ce045b4cc5f0865d2480b714cd41e0b2b2c0 ```
Reported by `helder.pereira.correia` on 2009-03-01 14:18:23 - Status changed: `Fixed` - Labels added: OpSys-All, Component-UI
-
Account Deleted ``` Issue 303 has been merged into this issue. ```
Reported by `helder.pereira.correia` on 2009-08-10 10:49:20
-
Account Deleted ``` Issue 363 has been merged into this issue. ```
Reported by `helder.pereira.correia` on 2010-11-09 06:12:27
-
repo owner - changed component to userinterface
-
assigned issue to
- edited description
- changed milestone to 0.11
-
repo owner - changed status to closed
- Log in to comment
``` 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