xdg-screensaver attempts to lock the screen with dcop, which is only correct in KDE version 3. KDE4 uses dbus. The presence of KDE can be detected by evaluating $KDE_SESSION_VERSION == 4? The correct command to lock the screen in KDE4 is qdbus org.kde.krunner /ScreenSaver Lock
The detection/use of KDE4 DE is already fixed in svn. Unfortunately, the mapping of xdg-screensaver commands to dbus equivalents is not complete.
Fwiw, what I've been trying to use and/or map to was: qdbus org.freedesktop.ScreenSaver /ScreenSaver commands available there include: Inhibit, GetActive, SetActive, Lock, UnInhibit Any additional help, insight, patches welcome.
Here are the commands for suspend, resume, reset and lock; I don't know how to check the status, and the reset command isn't working for me...There is some documentation on the DBUS API at <http://www.mail-archive.com/xdg@lists.freedesktop.org/msg03804.html>. # suspend cookie=$(qdbus org.freedesktop.ScreenSaver /ScreenSaver Inhibit "$$" \ "Suspending screensaver while Window $window_id is open") # the suspense is removed when the calling process exits, so the # script needs to fork to call it # resume qdbus org.freedesktop.ScreenSaver /ScreenSaver Uninhibit $cookie # reset qdbus org.freedesktop.ScreenSaver /ScreenSaver SetActive False # or qdbus org.freedesktop.ScreenSaver /ScreenSaver SimulateUserActivity # but neither is working for me. SetActive True does launch the # screensaver without locking though # lock qdbus org.kde.krunner /ScreenSaver Lock
Initial support is already in cvs.
$ qdbus org.freedesktop.ScreenSaver /ScreenSaver signal void org.freedesktop.ScreenSaver.ActiveChanged(bool) method bool org.freedesktop.ScreenSaver.GetActive() method uint org.freedesktop.ScreenSaver.GetActiveTime() method uint org.freedesktop.ScreenSaver.GetSessionIdleTime() method uint org.freedesktop.ScreenSaver.Inhibit(QString application_name, QString reason_for_inhibit) method void org.freedesktop.ScreenSaver.Lock() method bool org.freedesktop.ScreenSaver.SetActive(bool e) method void org.freedesktop.ScreenSaver.SimulateUserActivity() method uint org.freedesktop.ScreenSaver.Throttle(QString application_name, QString reason_for_inhibit) method void org.freedesktop.ScreenSaver.UnInhibit(uint cookie) method void org.freedesktop.ScreenSaver.UnThrottle(uint cookie)
now it need to detect kde4, i just done a simple patch like this : Index: xdg-screensaver =================================================================== RCS file: /cvs/portland/portland/xdg-utils/scripts/xdg-screensaver,v retrieving revision 1.41 diff -r1.41 xdg-screensaver 334c334,335 < if [ x"$KDE_FULL_SESSION" = x"true" ]; then DE=kde; --- > if [ x"$KDE_FULL_SESSION" = x"true" ] && [ x"$KDE_SESSION_VERSION" = x"4" ]; then DE=kde4; > elif [ x"$KDE_FULL_SESSION" = x"true" ]; then DE=kde3; 416c417 < kde) --- > kde3) 419c420,422 < --- > kde4) > screensaver_freedesktop "$1" > ;;
Fixed in CVS
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.