Comment 18 for bug 310351


I am using xdg-screensaver with KDE4, and whereas Inhibit seems to disable the screen saver, it does not disable the screen autolock feature. Looking for the bug, I found that SimulateUserActivity had to be used, but I modified xdg-screensaver in a way that should make it still compatible with other window managers, by adding the look calling SimulateUserActivity in the track_window() function, while waiting for the xprop process to exit.


diff --git a/scripts/ b/scripts/
index 579b80e..84369cb 100644
--- a/scripts/
+++ b/scripts/
@@ -216,6 +216,13 @@ track_window()
   echo "$window_id:$xprop_pid" >> $tmpfile
   $MV "$tmpfile" "$screensaver_file"
+ # in KDE4, simulating user activity prevents the screensaver autolock
+ if [ "$DE" = "kde" -a x"$KDE_SESSION_VERSION" = x"4" ]; then
+ while kill -0 $xprop_pid; do
+ qdbus org.freedesktop.ScreenSaver /ScreenSaver SimulateUserActivity > /dev/null
+ sleep 5
+ done
+ fi
   # Wait for xprop to edit, it means that the window disappeared
   wait $xprop_pid
   # Clean up the administration and resume the screensaver