aboutsummaryrefslogtreecommitdiff
path: root/src/yuzu/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/yuzu/main.cpp')
-rw-r--r--src/yuzu/main.cpp23
1 files changed, 16 insertions, 7 deletions
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp
index fc7a953d77..4d5238643c 100644
--- a/src/yuzu/main.cpp
+++ b/src/yuzu/main.cpp
@@ -1770,16 +1770,25 @@ void GMainWindow::OnDisplayTitleBars(bool show) {
void GMainWindow::SetupPrepareForSleep() {
#ifdef __unix__
- auto bus = QDBusConnection::systemBus();
- if (bus.isConnected()) {
+ if (auto bus = QDBusConnection::systemBus(); bus.isConnected()) {
+ // See https://github.com/ConsoleKit2/ConsoleKit2/issues/150
+#ifdef __linux__
+ const auto dbus_logind_service = QStringLiteral("org.freedesktop.login1");
+ const auto dbus_logind_path = QStringLiteral("/org/freedesktop/login1");
+ const auto dbus_logind_manager_if = QStringLiteral("org.freedesktop.login1.Manager");
+ //const auto dbus_logind_session_if = QStringLiteral("org.freedesktop.login1.Session");
+#else
+ const auto dbus_logind_service = QStringLiteral("org.freedesktop.ConsoleKit");
+ const auto dbus_logind_path = QStringLiteral("/org/freedesktop/ConsoleKit/Manager");
+ const auto dbus_logind_manager_if = QStringLiteral("org.freedesktop.ConsoleKit.Manager");
+ //const auto dbus_logind_session_if = QStringLiteral("org.freedesktop.ConsoleKit.Session");
+#endif
const bool success = bus.connect(
- QStringLiteral("org.freedesktop.login1"), QStringLiteral("/org/freedesktop/login1"),
- QStringLiteral("org.freedesktop.login1.Manager"), QStringLiteral("PrepareForSleep"),
+ dbus_logind_service, dbus_logind_path,
+ dbus_logind_manager_if, QStringLiteral("PrepareForSleep"),
QStringLiteral("b"), this, SLOT(OnPrepareForSleep(bool)));
-
- if (!success) {
+ if (!success)
LOG_WARNING(Frontend, "Couldn't register PrepareForSleep signal");
- }
} else {
LOG_WARNING(Frontend, "QDBusConnection system bus is not connected");
}