Monday, April 29, 2024
2
rated 0 times [  2] [ 0]  / answers: 1 / hits: 4347  / 3 Years ago, wed, may 5, 2021, 9:47:21

I am developing a program using quickly. I am using an indicator which can hide/show the main window.



But when I launch the application from the launcher it starts a new instance of that application (so an additional indicator will be shown). Rather than just showing the main window of the previous running app.



What's the usual way of forcing only one indicator?


More From » application-development

 Answers
1

First, make sure you have a good reason to do this. People expect applications to work as you describe in your post. Even though you personally might not like it.



But, to answer your question, one of the easiest ways to do it is by making a file (for example in the configuration directory) at startup, which you remove when your application exits. Before starting the application, you check in your code if another instance is already active, and if so, you exit directly. If you also want to focus the active application, you need a way to do inter process communication. For example via a socket. See http://docs.python.org/library/ipc.html for more info.


[#37315] Thursday, May 6, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
sator

Total Points: 258
Total Questions: 119
Total Answers: 101

Location: Sweden
Member since Fri, Apr 16, 2021
3 Years ago
;