How to create a single instance app? (Solved)
How to create a single instance app?
Must be more than one or two ways to do this.. I suspect.
Wrapper scripts are somewhat workarounds that I would like to leave out here.
Same with the temporary files on the disk.
Maybe use signal.h - before GUI creation?
And peek if another instance is already running, then send, say a signal or
ClientMessage, etc. that another instance knows and can monitor, to trigger some
predefined action?
Story 1, simple:
App A is clicked on the panel toolbar and runs.
App A is clicked again, the panel will not toggle or manage that.
Now A1 and A2 run both.
Question:
How A2 sends the signal S to A1 so that both quit?
Note:
Only the signal is sent and monitored.
A2 will not make it to GUI.
Story 2, tricky:
App A is set as a default handler for filetype C.
A uses child process B* to open file C.
When C is clicked in the filemanager, A runs Ba or Bb or B* to open the C,
depending on the C subtype.
Question:
When A1 runs B* with C1 - and C2 is clicked, how to hand over C2 to A1 from A2 ?
So that A1 would stop B* and start over with C2, while A2 quits.
Note:
Here we have at least a filename, with unknown lenght and size, aside the signal.
String buffer size used in main is 1024 before gtk_init
I hope it was readable
PS. Both apps are GTK2.