Bug 17537

Summary: xdg-screensaver fails with KDE4, tries to use dcop instead of dbus
Product: Portland Reporter: Moritz Moeller-Herrmann <moritz-freedesktop>
Component: xdg-utilsAssignee: Fathi Boudra <fabo>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium CC: yaohan.chen
Version: 1.0Keywords: patch
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Bug Depends on:    
Bug Blocks: 23105    

Description Moritz Moeller-Herrmann 2008-09-11 13:50:31 UTC
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
Comment 1 Rex Dieter 2008-09-11 13:55:12 UTC
The detection/use of KDE4 DE is already fixed in svn.

Unfortunately, the mapping of xdg-screensaver commands to dbus equivalents is not complete.
Comment 2 Rex Dieter 2008-09-11 13:59:13 UTC
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.

Comment 3 Yaohan Chen 2009-02-14 23:27:37 UTC
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


Comment 4 Rex Dieter 2009-02-15 05:03:25 UTC
Initial support is already in cvs.
Comment 5 Fathi Boudra 2009-07-26 09:24:05 UTC
$ 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)
Comment 6 Nicolas Lécureuil 2009-08-02 14:18:20 UTC
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"
>       ;;
Comment 7 Fathi Boudra 2009-08-03 04:54:10 UTC
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.