I added a shortcut to an application in ubuntu. Each time i press shortcut keys, a new instance of application is created. I need only one instance, what script i can use to open the existing instance of application or creates a new one if the application is not running?
Share
It depends greatly on the application. The most trivial case would be the known process name which can only be run by you (that is, no stray instances on the system):
Opening an existing application may get tricky and, again, depends on the application. I’d suggest that you take a look at alltray thingie and pay special attention to the
alltray --helpoutput.Edit by ypnos:
If you want to restrict this to the current user only, you should use pgrep instead of pidof, like this: