Package: kde-workspace-bin Version: 4:4.11.13-1 --- Please enter the report below this line. ---
Summary: KDE reads the Version property of org.freedesktop.systemd1.Manager interface and hides the Suspend/Hibernate buttons if it is not new enough, but systemd-shim doesn't implement that property. Attached is a patch for systemd-shim to workaround this issue. Looking through ./powerdevil/daemon/backends/upower/powerdevilupowerbackend.cpp there are 2 implementations, one using the login1 interface, another using upower: if (m_login1Interface && checkSystemdVersion(195)) { ... } else { if (m_upowerInterface->canSuspend() && m_upowerInterface->SuspendAllowed()) { ... } upower in its latest version doesn't support suspend/resume anymore so we'd want to use the login1 interface. This seems to be provide by systemd-shim, and says that Suspend is supported: $ qdbus --system org.freedesktop.login1 /org/freedesktop/login1 org.freedesktop.login1.Manager.CanSuspend yes $ qdbus --system org.freedesktop.login1 /org/freedesktop/login1 org.freedesktop.login1.Manager.CanSuspend yes KDE also does a version check on the interface though, which is this code: QDBusInterface systemdIface("org.freedesktop.systemd1", "/org/freedesktop/systemd1", "org.freedesktop.systemd1.Manager", QDBusConnection::systemBus(), 0); const QString reply = systemdIface.property("Version").toString(); QRegExp expsd("(systemd )?([0-9]+)"); systemd-shim doesn't implement Version in org.freedesktop.systemd1.Manager: $ dbus-send --system --print-reply --type=method_call --dest="org.freedesktop.systemd1" /org/freedesktop/systemd1 org.freedesktop.DBus.Properties.Get string:"org.freedesktop.systemd1.Manager" string:Version $ qdbus --system org.freedesktop.systemd1 /org/freedesktop/systemd1 org.freedesktop.DBus.Properties.Get org.freedesktop.systemd1.Manager Version Error: org.freedesktop.DBus.Error.InvalidArgs No such property 'Version' According to the documentation[0] the Version property is NOT part of the API, so KDE would be wrong for using it... However as a quick workaround I patched systemd-shim to provide the Version property: $ apt-get source systemd-shim && cd systemd-shim-8 $ quilt import ~/add-manager-version.patch $ quilt push -a $ dpkg-buildpackage -us -uc $ sudo dpkg -i ../systemd-shim_8-3_amd64.deb Reboot (the menu entry would show up after restarting dbus and logout/login, but the Suspend method would give permission denied, probably more things need to be restarted). Now there is a Sleep entry in the Leave menu! I have reported a bug at upstream KDE about using the 'Version' property: https://bugs.kde.org/show_bug.cgi?id=340206 [0] http://www.freedesktop.org/wiki/Software/systemd/dbus/ --- System information. --- Architecture: amd64 Kernel: Linux 3.16-2-amd64 Debian Release: jessie/sid 500 unstable ftp.ro.debian.org 500 testing ftp.ro.debian.org 1 experimental ftp.ro.debian.org --- Package information. --- Depends (Version) | Installed =================================================-+-================= iso-codes | 3.56-1 kde-runtime (>= 4:4.10.2) | 4:4.14.1-1+b1 kde-workspace-data (= 4:4.11.11-1) | 4:4.11.13-1 kde-workspace-kgreet-plugins (= 4:4.11.11-1) | 4:4.11.13-1 kscreen | 1.0.2.1-1 plasma-desktop (= 4:4.11.11-1) | 4:4.11.13-1 OR plasma-netbook (= 4:4.11.11-1) | 4:4.11.13-1 qdbus | 4:4.8.6+git64-g5dc8b2b+dfsg-2+b1 x11-utils | 7.7+2 x11-xserver-utils | 7.7+3 kde-style-oxygen (= 4:4.11.11-1) | 4:4.11.13-1 libc6 (>= 2.15) | libcln6 | libdbusmenu-qt2 (>= 0.6.0) | libfontconfig1 (>= 2.11) | libfreetype6 (>= 2.2.1) | libgcc1 (>= 1:4.1.1) | libgl1-mesa-glx | OR libgl1 | libice6 (>= 1:1.0.0) | libjpeg8 (>= 8c) | libkactivities6 (>= 4:4.11) | libkcmutils4 (>= 4:4.11) | libkdeclarative5 (>= 4:4.7.0) | libkdecore5 (>= 4:4.11) | libkdesu5 (>= 4:4.11) | libkdeui5 (>= 4:4.11) | libkfile4 (>= 4:4.11) | libkidletime4 (>= 4:4.11) | libkio5 (>= 4:4.11) | libknewstuff3-4 (>= 4:4.11) | libknotifyconfig4 (>= 4:4.11) | libkparts4 (>= 4:4.11) | libkpty4 (>= 4:4.11) | libkscreensaver5 (= 4:4.11.11-1) | libkworkspace4abi2 (= 4:4.11.11-1) | libnepomukcore4 (>= 4:4.10.0) | libpam0g (>= 0.99.7.1) | libphonon4 (>= 4:4.2.0) | libplasma3 (>= 4:4.11) | libplasmagenericshell4 (= 4:4.11.11-1) | libpng12-0 (>= 1.2.13-4) | libprocesscore4abi1 (= 4:4.11.11-1) | libprocessui4a (= 4:4.11.11-1) | libqalculate5 | libqimageblitz4 (>= 1:0.0.4) | libqjson0 (>= 0.7.1) | libqt4-dbus (>= 4:4.8.0) | libqt4-declarative (>= 4:4.7.0~rc1) | libqt4-sql (>= 4:4.5.3) | libqt4-xml (>= 4:4.5.3) | libqtcore4 (>= 4:4.8.0) | libqtgui4 (>= 4:4.8.0) | libsm6 | libsolid4 (>= 4:4.11.1) | libsoprano4 (>= 2.7.56) | libstdc++6 (>= 4.6) | libstreamanalyzer0 (>= 0.7.8) | libudev1 (>= 183) | libusb-0.1-4 (>= 2:0.1.12) | libx11-6 | libxcursor1 (>> 1.1.2) | libxext6 | libxfixes3 | libxft2 (>> 2.1.1) | libxi6 (>= 2:1.1.2) | libxinerama1 | libxkbfile1 | libxrandr2 (>= 2:1.2.0) | libxrender1 | libxtst6 | phonon | Recommends (Version) | Installed ===================================-+-=========== plasma-scriptengines | 4:4.11.13-1 polkit-kde-1 (>= 0.99) | 0.99.1-1 OR policykit-1-gnome | 0.105-2 upower | 0.99.1-3 Suggests (Version) | Installed ============================-+-=========== x11-xkb-utils | 7.7+1
Author: Török Edwin <ed...@etorok.net> Description: implement org.freedesktop.systemd1.Manager Version property Bug-Debian: http://bugs.debian.org/747180 Although the documentation[0] says that 'Version' is not part of the API powerdevil (kde-workspace) has a checkSystemdVersion function that shows/hides the Suspend/Resume/Hibernate buttons based on that. [0] http://www.freedesktop.org/wiki/Software/systemd/dbus/ Index: systemd-shim-8/src/systemd-iface.h =================================================================== --- systemd-shim-8.orig/src/systemd-iface.h +++ systemd-shim-8/src/systemd-iface.h @@ -44,6 +44,7 @@ static const gchar *systemd_iface = "</method>" "<method name='Subscribe'/>" "<method name='Unsubscribe'/>" + "<property name='Version' type='s' access='read'/>" "<property name='Virtualization' type='s' access='read'/>" "</interface>" "<interface name='org.freedesktop.systemd1.Scope'>" Index: systemd-shim-8/src/systemd-shim.c =================================================================== --- systemd-shim-8.orig/src/systemd-shim.c +++ systemd-shim-8/src/systemd-shim.c @@ -202,11 +202,16 @@ shim_get_property (GDBusConnection *con had_activity (); - g_assert_cmpstr (property_name, ==, "Virtualization"); + if (g_strcmp0(property_name, "Virtualization") == 0) { + detect_virtualization (&id); + return g_variant_new ("s", id); + } - detect_virtualization (&id); + if (g_strcmp0(property_name, "Version") == 0) { + return g_variant_new_take_string (g_strdup_printf("systemd %d", SYSTEMD_VERSION)); + } - return g_variant_new ("s", id); + return NULL; } static gchar *