Skip to content

Commit

Permalink
Current version of Psi+ is 1.5.2064
Browse files Browse the repository at this point in the history
It is based on:
* psi: 24d7fced
* plugins: 347230b
* psimedia: 478567e
* resources: fc4cfc1
  • Loading branch information
tehnick committed Oct 15, 2024
1 parent cbcb9e3 commit 54120b7
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 15 deletions.
45 changes: 31 additions & 14 deletions src/tools/idle/idle_x11.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,12 @@ class IdlePlatform::Private {
Private() { }

#ifdef USE_DBUS
QString dbusService = QString();
struct {
QString name = QString();
QString path = QString();
QString method = QString();
bool isGnome = false;
} idleService;
#endif // USE_DBUS
#ifdef HAVE_XSS
XScreenSaverInfo *ss_info = nullptr;
Expand Down Expand Up @@ -110,12 +115,25 @@ bool IdlePlatform::init()
#ifdef USE_DBUS
// if DBUS idle is available using it else try to use XSS functions
const auto services = QDBusConnection::sessionBus().interface()->registeredServiceNames().value();
const QStringList idleServices = { COMMON_SS_SERV, KDE_SS_SERV, GNOME_SS_SERV };
const QStringList idleServices = { GNOME_SS_SERV, COMMON_SS_SERV, KDE_SS_SERV };
// find first available dbus-service
for (const auto &service : idleServices) {
if (services.contains(service)) {
d->dbusService = service;
return true;
bool isGnome = (service == GNOME_SS_SERV);
auto path = isGnome ? GNOME_SS_PATH : COMMON_SS_PATH;
auto interface = QDBusInterface(service, path, "org.freedesktop.DBus.Introspectable");
if (interface.isValid()) {
QDBusReply<QString> reply = interface.call("Introspect");
if (reply.isValid()) {
if (reply.value().contains(isGnome ? GNOME_SS_F : COMMON_SS_F)) {
d->idleService.name = service;
d->idleService.path = path;
d->idleService.method = isGnome ? GNOME_SS_F : COMMON_SS_F;
d->idleService.isGnome = isGnome;
return true;
}
}
}
}
}
#endif // USE_DBUS
Expand All @@ -140,18 +158,17 @@ bool IdlePlatform::init()
int IdlePlatform::secondsIdle()
{
#ifdef USE_DBUS
if (!d->dbusService.isEmpty()) {
if (!d->idleService.name.isEmpty()) {
// KDE and freedesktop uses the same path interface and method but gnome uses other
bool isNotGnome = d->dbusService == COMMON_SS_SERV || d->dbusService == KDE_SS_SERV;
const QLatin1String iface = isNotGnome ? COMMON_SS_SERV : GNOME_SS_SERV;
const QLatin1String path = isNotGnome ? COMMON_SS_PATH : GNOME_SS_PATH;
const QLatin1String method = isNotGnome ? COMMON_SS_F : GNOME_SS_F;
auto interface = QDBusInterface(d->dbusService, path, iface);
auto interface = QDBusInterface(d->idleService.name, d->idleService.path, d->idleService.name);
if (interface.isValid()) {
QDBusReply<uint> reply = interface.call(method);
// probably reply value for freedesktop and kde need to be converted to seconds
if (reply.isValid())
return isNotGnome ? reply.value() / 1000 : reply.value();
QDBusMessage reply = interface.call(d->idleService.method);
if (reply.type() == QDBusMessage::ReplyMessage && reply.arguments().count() > 0) {
auto result = reply.arguments().at(0);
if (result.canConvert<int>())
// reply should be in milliseconds and must be converted to seconds
return result.toInt() / 1000;
}
}
}
#endif // USE_DBUS
Expand Down
2 changes: 1 addition & 1 deletion version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.5.2063 (2024-10-13, 723e747e)
1.5.2064 (2024-10-15, 24d7fced)

0 comments on commit 54120b7

Please sign in to comment.