mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 14:17:12 +02:00
Fix event loop for non-first instance on Linux
This commit is contained in:
parent
4247fd0c0f
commit
e78975d770
1 changed files with 18 additions and 1 deletions
|
@ -245,6 +245,22 @@ void LaunchGApplication() {
|
|||
.chopped(8)
|
||||
.toStdString();
|
||||
|
||||
const auto owned = [&] {
|
||||
if (!Gio::Application::id_is_valid(appId)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
return base::Platform::DBus::NameHasOwner(
|
||||
Gio::DBus::Connection::get_sync(
|
||||
Gio::DBus::BusType::SESSION),
|
||||
appId);
|
||||
} catch (...) {
|
||||
}
|
||||
|
||||
return false;
|
||||
}();
|
||||
|
||||
const auto app = Glib::wrap(
|
||||
G_APPLICATION(
|
||||
g_object_new(
|
||||
|
@ -254,7 +270,8 @@ void LaunchGApplication() {
|
|||
? appId.c_str()
|
||||
: nullptr,
|
||||
"flags",
|
||||
G_APPLICATION_HANDLES_OPEN,
|
||||
G_APPLICATION_HANDLES_OPEN
|
||||
| (owned ? G_APPLICATION_NON_UNIQUE : 0),
|
||||
nullptr)));
|
||||
|
||||
app->signal_startup().connect([=] {
|
||||
|
|
Loading…
Add table
Reference in a new issue