conky icon indicating copy to clipboard operation
conky copied to clipboard

avoid multiple running instances

Open movinator opened this issue 3 years ago • 6 comments

Avoid multiple running instances

  • I like to use saved session on kde and it happens, that on startup multiple instances of conky will be created. I don't know, whether this behaviour is related to my number of virtual desktops or whatever, so I changed conky to not start, if it is already running.
  • Standard behaviour is not changed. Changed app just refuses to start if there is an instance already running
  • Tested: from terminal start one instance with "conky -d" and then start conky without -d switch. conky will respond, that it is already running and quits.

movinator avatar Aug 22 '21 06:08 movinator

I also have been bothered by KDE restarting Conky while I had it in my startup settings. But I can see at least two problems here:

  • ps -e won't work on all OSes Conky can run on. Not on Haiku where ps does not conform to POSIX and XSI extension. Maybe not even on OSX where "-e" means "Display the environment as well".
  • Some people might actually want to start two Conky instances, with different config files, on different parts of the screens. This would prevent it.

mmuman avatar Oct 25 '21 13:10 mmuman

My desktop has 5 instances of conky running, each with a different config file. I hope that this change will not affect my normal usage. Perhaps the check needs to be enhanced to include the entire command line and only fail if multiple instances would be running with identical command line arguments

skunktrading avatar Oct 28 '21 03:10 skunktrading

Yes, maybe some PID file named after the command line args (or a hash of them)? Check if there is one, and if the PID still runs…

mmuman avatar Oct 28 '21 07:10 mmuman

what about adding a commandline option which prevents start of other instances? Then both use cases could be supported

movinator avatar Oct 28 '21 11:10 movinator

That won't work for the case where you run more than one instance but also want to use KDE's session restoring feature. Unless it also handles finding the existing instance for the same args.

mmuman avatar Oct 28 '21 12:10 mmuman

Yeah for now I also run 7-8 instances each with different configs, I don't think many people would want to run 2 instances with identical configs so maybe thats an approach you could look at.

simotek avatar Apr 05 '23 12:04 simotek