// gKeyMapper - keep exactly one GUI: a new start replaces the running instance. #ifndef GKEYMAPPER_SINGLEINSTANCE_H #define GKEYMAPPER_SINGLEINSTANCE_H #include namespace gkeymapper { // Asks the instance that owns `appId` on the session bus to quit and waits until // it has let go of the name, so the caller can become the only instance. The // request goes through the app's `quit` action (exported by GApplication as // org.gtk.Actions); an instance that does not offer it — an older build — is // terminated with SIGTERM instead, after checking that the bus name really // belongs to a gkeymapper process. // // Returns true when the name is free afterwards, which is also the case when // nobody owned it. The caller still runs its usual single-instance logic, so a // `false` (a hung instance that cannot be closed) only means "no new window". bool replace_running_instance(const std::string& appId); } // namespace gkeymapper #endif // GKEYMAPPER_SINGLEINSTANCE_H