Merge lp:~ochosi/xdg-utils/support_xfce into lp:ubuntu/utopic/xdg-utils

Proposed by Simon Steinbeiß
Status: Merged
Merged at revision: 23
Proposed branch: lp:~ochosi/xdg-utils/support_xfce
Merge into: lp:ubuntu/utopic/xdg-utils
Diff against target: 1081 lines (+1034/-1)
6 files modified
.pc/applied-patches (+1/-0)
.pc/xfce-blanking.diff/scripts/xdg-screensaver (+1005/-0)
debian/changelog (+7/-0)
debian/patches/series (+1/-0)
debian/patches/xfce-blanking.diff (+19/-0)
scripts/xdg-screensaver (+1/-1)
To merge this branch: bzr merge lp:~ochosi/xdg-utils/support_xfce
Reviewer Review Type Date Requested Status
Didier Roche-Tolomelli Approve
Sebastien Bacher Needs Information
Review via email: mp+224076@code.launchpad.net

This proposal supersedes a proposal from 2014-06-16.

Description of the change

This is a very simple patch that provides a fallback for the Xfce DE. Until 14.04, we used xscreensaver, so there was no special case needed for Xfce. However, now that we're using light-locker, xdg-screensaver should handle the X11 screensaver extension's settings (if XScreenSaver isn't installed or in use).

This simple patch does exactly that. It checks for the "xfce" DE *after* checking for XScreenSaver and then let's xdg-screensaver handle things correctly.

This branch fixes https://bugs.launchpad.net/ubuntu/+source/xdg-utils/+bug/1309744

To post a comment you must log in.
Revision history for this message
Simon Steinbeiß (ochosi) wrote : Posted in a previous version of this proposal

Here goes the upstream bugreport: https://bugs.freedesktop.org/show_bug.cgi?id=80089

Revision history for this message
Sebastien Bacher (seb128) wrote : Posted in a previous version of this proposal

Thanks, could you change the merge target to be lp:ubuntu/xdg-utils? The change seems fine to me, but I see that there is some alternative approch discussion on the upstream bug report, so I'm going to wait a few days to see if things come to an agreement there and use the upstream solution if they get one

Revision history for this message
Sebastien Bacher (seb128) wrote :

Looking to that again, your upstream merge request patches the .in, should we do the same here in case those files got regenerated? You also mentioned that the change would be a candidate for a SRU, could update the bug report with the rational/test case/regression potential informations?

review: Needs Information
Revision history for this message
Simon Steinbeiß (ochosi) wrote :

> Looking to that again, your upstream merge request patches the .in, should we
> do the same here in case those files got regenerated?

Yeah, that would make sense I guess.

> You also mentioned that the change would be a candidate for a SRU, could update the bug report with
> the rational/test case/regression potential informations?

I thought I need to report a separate bug for the SRU anyhow with all that information, but only after it's in Utopic?
I can also do it now, I guess I was just confused there about the exact procedure.

Revision history for this message
Didier Roche-Tolomelli (didrocks) wrote :

for reference:
didrocks | ochosi: seems that you are doing an inline patch
didrocks | would be better to add it as a patch
didrocks | also, I think you can break other use case with replacing '' by 'xfce'
  ochosi | no
didrocks | shouldn't you just append (before the '') the 'xfce' case?
  ochosi | the thing is, that there is a second ''
  ochosi | i submitted another bug report about that
  ochosi | ubuntu is carrying a useless patch, which duplicates code
didrocks | ah indeed
  ochosi | so i thought i'd use that duplication to my advantage for now
didrocks | so yeah, the replacement is fine
  ochosi | simply to produce the most minimal patch
  ochosi | to get SRU'd ;)
didrocks | however, this should be carried as a patch, not an inline change?
  ochosi | sure, i'm fine with that
didrocks | ochosi: ok, just do that change and I'll +1 for utopic
  ochosi | although after it's SRU'd I think it should be done properly
didrocks | ochosi: yeah, try to get it into debian/upstream to not have that as a patch :)
  ochosi | i've gotten in touch with upstream, but after the initial reply i haven't heard back...
  ochosi | ofc :)
  ochosi | i know it's a bit silly
didrocks | but let's do it as a patch first to unblock your SRU
  ochosi | yup, thanks!
didrocks | yw, just ping me back :)
didrocks | (also provides a changelog with the bug ref and so on)
  ochosi | ok, i haven't ever done a debian patch, but i'll give it a shot
       * | ochosi isn't a coder anyways...
didrocks | ochosi: poke me if you need any help, look for "quilt" ;)
didrocks | ochosi: https://wiki.debian.org/UsingQuilt
       * | ochosi only understands "scotland"
didrocks | and http://packaging.ubuntu.com/html/patches-to-packages.html
didrocks | heh ;)

review: Needs Fixing
lp:~ochosi/xdg-utils/support_xfce updated
22. By Simon Steinbeiß

Add fallback-mode for Xfce (only gets used if xscreensaver isn't installed/in use)

23. By Simon Steinbeiß

Add patch tags

Revision history for this message
Didier Roche-Tolomelli (didrocks) wrote :

approving with latest changes

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file '.pc/applied-patches'
--- .pc/applied-patches 2011-10-03 16:06:10 +0000
+++ .pc/applied-patches 2014-07-16 09:36:41 +0000
@@ -11,3 +11,4 @@
11gnome-3.0.diff11gnome-3.0.diff
12lp779156-lubuntu.diff12lp779156-lubuntu.diff
13xdg-screensaver-dbus.patch13xdg-screensaver-dbus.patch
14xfce-blanking.diff
1415
=== added directory '.pc/xfce-blanking.diff'
=== added file '.pc/xfce-blanking.diff/.timestamp'
=== added directory '.pc/xfce-blanking.diff/scripts'
=== added file '.pc/xfce-blanking.diff/scripts/xdg-screensaver'
--- .pc/xfce-blanking.diff/scripts/xdg-screensaver 1970-01-01 00:00:00 +0000
+++ .pc/xfce-blanking.diff/scripts/xdg-screensaver 2014-07-16 09:36:41 +0000
@@ -0,0 +1,1005 @@
1#!/bin/sh
2#---------------------------------------------
3# xdg-screensaver
4#
5# Utility script to control screensaver.
6#
7# Refer to the usage() function below for usage.
8#
9# Copyright 2006, Bryce Harrington <bryce@osdl.org>
10#
11# LICENSE:
12#
13# Permission is hereby granted, free of charge, to any person obtaining a
14# copy of this software and associated documentation files (the "Software"),
15# to deal in the Software without restriction, including without limitation
16# the rights to use, copy, modify, merge, publish, distribute, sublicense,
17# and/or sell copies of the Software, and to permit persons to whom the
18# Software is furnished to do so, subject to the following conditions:
19#
20# The above copyright notice and this permission notice shall be included
21# in all copies or substantial portions of the Software.
22#
23# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
24# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
26# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
27# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
28# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
29# OTHER DEALINGS IN THE SOFTWARE.
30#
31#---------------------------------------------
32
33manualpage()
34{
35cat << _MANUALPAGE
36Name
37
38xdg-screensaver - command line tool for controlling the screensaver
39
40Synopsis
41
42xdg-screensaver suspend WindowID
43
44xdg-screensaver resume WindowID
45
46xdg-screensaver { activate | lock | reset | status }
47
48xdg-screensaver { --help | --manual | --version }
49
50Description
51
52xdg-screensaver provides commands to control the screensaver.
53
54xdg-screensaver is for use inside a desktop session only. It is not recommended
55to use xdg-screensaver as root.
56
57Commands
58
59suspend WindowID
60
61 Suspends the screensaver and monitor power management. WindowID must be the
62 X Window ID of an existing window of the calling application. The window
63 must remain in existance for the duration of the suspension.
64
65 WindowID can be represented as either a decimal number or as a hexadecimal
66 number consisting of the prefix 0x followed by one or more hexadecimal
67 digits.
68
69 The screensaver can be suspended in relation to multiple windows at the
70 same time. In that case screensaver operation is only restored once the
71 screensaver has been resumed in relation to each of the windows
72
73resume WindowID
74 Resume the screensaver and monitor power management after being suspended.
75 WindowID must be the same X Window ID that was passed to a previous call of
76 xdg-screensaver suspend
77activate
78 Turns the screensaver on immediately. This may result in the screen getting
79 locked, depending on existing system policies.
80lock
81 Lock the screen immediately.
82reset
83 Turns the screensaver off immediately. If the screen was locked the user
84 may be asked to authenticate first.
85status
86 Prints enabled to stdout if the screensaver is enabled to turn on after a
87 period of inactivity and prints disabled if the screensaver is not enabled.
88
89Options
90
91--help
92 Show command synopsis.
93--manual
94 Show this manualpage.
95--version
96 Show the xdg-utils version information.
97
98Exit Codes
99
100An exit code of 0 indicates success while a non-zero exit code indicates
101failure. The following failure codes can be returned:
102
1031
104 Error in command line syntax.
1053
106 A required tool could not be found.
1074
108 The action failed.
109
110Examples
111
112xdg-screensaver suspend 0x1c00007
113
114Causes the screensaver to be disabled till xdg-screensaver resume 0x1c00007 is
115called. 0x1c00007 must be the X Window ID of an existing window.
116
117_MANUALPAGE
118}
119
120usage()
121{
122cat << _USAGE
123xdg-screensaver - command line tool for controlling the screensaver
124
125Synopsis
126
127xdg-screensaver suspend WindowID
128
129xdg-screensaver resume WindowID
130
131xdg-screensaver { activate | lock | reset | status }
132
133xdg-screensaver { --help | --manual | --version }
134
135_USAGE
136}
137
138#@xdg-utils-common@
139
140#----------------------------------------------------------------------------
141# Common utility functions included in all XDG wrapper scripts
142#----------------------------------------------------------------------------
143
144DEBUG()
145{
146 [ -z "${XDG_UTILS_DEBUG_LEVEL}" ] && return 0;
147 [ ${XDG_UTILS_DEBUG_LEVEL} -lt $1 ] && return 0;
148 shift
149 echo "$@" >&2
150}
151
152#-------------------------------------------------------------
153# Exit script on successfully completing the desired operation
154
155exit_success()
156{
157 if [ $# -gt 0 ]; then
158 echo "$@"
159 echo
160 fi
161
162 exit 0
163}
164
165
166#-----------------------------------------
167# Exit script on malformed arguments, not enough arguments
168# or missing required option.
169# prints usage information
170
171exit_failure_syntax()
172{
173 if [ $# -gt 0 ]; then
174 echo "xdg-screensaver: $@" >&2
175 echo "Try 'xdg-screensaver --help' for more information." >&2
176 else
177 usage
178 echo "Use 'man xdg-screensaver' or 'xdg-screensaver --manual' for additional info."
179 fi
180
181 exit 1
182}
183
184#-------------------------------------------------------------
185# Exit script on missing file specified on command line
186
187exit_failure_file_missing()
188{
189 if [ $# -gt 0 ]; then
190 echo "xdg-screensaver: $@" >&2
191 fi
192
193 exit 2
194}
195
196#-------------------------------------------------------------
197# Exit script on failure to locate necessary tool applications
198
199exit_failure_operation_impossible()
200{
201 if [ $# -gt 0 ]; then
202 echo "xdg-screensaver: $@" >&2
203 fi
204
205 exit 3
206}
207
208#-------------------------------------------------------------
209# Exit script on failure returned by a tool application
210
211exit_failure_operation_failed()
212{
213 if [ $# -gt 0 ]; then
214 echo "xdg-screensaver: $@" >&2
215 fi
216
217 exit 4
218}
219
220#------------------------------------------------------------
221# Exit script on insufficient permission to read a specified file
222
223exit_failure_file_permission_read()
224{
225 if [ $# -gt 0 ]; then
226 echo "xdg-screensaver: $@" >&2
227 fi
228
229 exit 5
230}
231
232#------------------------------------------------------------
233# Exit script on insufficient permission to write a specified file
234
235exit_failure_file_permission_write()
236{
237 if [ $# -gt 0 ]; then
238 echo "xdg-screensaver: $@" >&2
239 fi
240
241 exit 6
242}
243
244check_input_file()
245{
246 if [ ! -e "$1" ]; then
247 exit_failure_file_missing "file '$1' does not exist"
248 fi
249 if [ ! -r "$1" ]; then
250 exit_failure_file_permission_read "no permission to read file '$1'"
251 fi
252}
253
254check_vendor_prefix()
255{
256 file_label="$2"
257 [ -n "$file_label" ] || file_label="filename"
258 file=`basename "$1"`
259 case "$file" in
260 [a-zA-Z]*-*)
261 return
262 ;;
263 esac
264
265 echo "xdg-screensaver: $file_label '$file' does not have a proper vendor prefix" >&2
266 echo 'A vendor prefix consists of alpha characters ([a-zA-Z]) and is terminated' >&2
267 echo 'with a dash ("-"). An example '"$file_label"' is '"'example-$file'" >&2
268 echo "Use --novendor to override or 'xdg-screensaver --manual' for additional info." >&2
269 exit 1
270}
271
272check_output_file()
273{
274 # if the file exists, check if it is writeable
275 # if it does not exists, check if we are allowed to write on the directory
276 if [ -e "$1" ]; then
277 if [ ! -w "$1" ]; then
278 exit_failure_file_permission_write "no permission to write to file '$1'"
279 fi
280 else
281 DIR=`dirname "$1"`
282 if [ ! -w "$DIR" -o ! -x "$DIR" ]; then
283 exit_failure_file_permission_write "no permission to create file '$1'"
284 fi
285 fi
286}
287
288#----------------------------------------
289# Checks for shared commands, e.g. --help
290
291check_common_commands()
292{
293 while [ $# -gt 0 ] ; do
294 parm="$1"
295 shift
296
297 case "$parm" in
298 --help)
299 usage
300 echo "Use 'man xdg-screensaver' or 'xdg-screensaver --manual' for additional info."
301 exit_success
302 ;;
303
304 --manual)
305 manualpage
306 exit_success
307 ;;
308
309 --version)
310 echo "xdg-screensaver 1.0.2"
311 exit_success
312 ;;
313 esac
314 done
315}
316
317check_common_commands "$@"
318
319[ -z "${XDG_UTILS_DEBUG_LEVEL}" ] && unset XDG_UTILS_DEBUG_LEVEL;
320if [ ${XDG_UTILS_DEBUG_LEVEL-0} -lt 1 ]; then
321 # Be silent
322 xdg_redirect_output=" > /dev/null 2> /dev/null"
323else
324 # All output to stderr
325 xdg_redirect_output=" >&2"
326fi
327
328#--------------------------------------
329# Checks for known desktop environments
330# set variable DE to the desktop environments name, lowercase
331
332detectDE()
333{
334 if [ x"$KDE_FULL_SESSION" = x"true" ]; then DE=kde;
335 elif [ x"$GNOME_DESKTOP_SESSION_ID" != x"" ]; then DE=gnome;
336 elif `dbus-send --print-reply --dest=org.freedesktop.DBus /org/freedesktop/DBus org.freedesktop.DBus.GetNameOwner string:org.gnome.SessionManager > /dev/null 2>&1` ; then DE=gnome;
337 elif xprop -root _DT_SAVE_MODE 2> /dev/null | grep ' = \"xfce4\"$' >/dev/null 2>&1; then DE=xfce;
338 elif [ x"$DESKTOP_SESSION" = x"LXDE" ]; then DE=lxde;
339 else DE=""
340 fi
341}
342
343#----------------------------------------------------------------------------
344# kfmclient exec/openURL can give bogus exit value in KDE <= 3.5.4
345# It also always returns 1 in KDE 3.4 and earlier
346# Simply return 0 in such case
347
348kfmclient_fix_exit_code()
349{
350 version=`kde${KDE_SESSION_VERSION}-config --version 2>/dev/null | grep '^KDE'`
351 major=`echo $version | sed 's/KDE.*: \([0-9]\).*/\1/'`
352 minor=`echo $version | sed 's/KDE.*: [0-9]*\.\([0-9]\).*/\1/'`
353 release=`echo $version | sed 's/KDE.*: [0-9]*\.[0-9]*\.\([0-9]\).*/\1/'`
354 test "$major" -gt 3 && return $1
355 test "$minor" -gt 5 && return $1
356 test "$release" -gt 4 && return $1
357 return 0
358}
359
360# Check if we can use "mv -T"
361if mv -T ... ... 2>&1 | grep '\.\.\.' > /dev/null ; then
362 # We can securely move files in /tmp with mv -T
363 DEBUG 1 "mv -T available"
364 MV="mv -T"
365 screensaver_file="/tmp/xdg-screensaver-$USER-"`echo $DISPLAY | sed 's/:/-/g'`
366else
367 # No secure moves available, use home dir
368 DEBUG 1 "mv -T not available"
369 MV="mv"
370 screensaver_file="$HOME/.xdg-screensaver-"`echo $(hostname)-$DISPLAY | sed 's/:/-/g'`
371fi
372lockfile_command=`which lockfile 2> /dev/null`
373
374lockfile()
375{
376 if [ -n "$lockfile_command" ] ; then
377 $lockfile_command -1 -l 10 -s 3 "$screensaver_file".lock
378 else
379 # Poor man's attempt at doing a lockfile
380 # Be careful not to facilitate a symlink attack
381 local try
382 try=0
383 while ! ln -s "$screensaver_file".lock "$screensaver_file".lock 2> /dev/null;
384 do
385 sleep 1
386 try=$(($try+1))
387 if [ $try -eq 3 ] ; then
388 rm -f "$screensaver_file".lock || return # Can't remove lockfile
389 try=0
390 fi
391 done
392 fi
393}
394
395unlockfile()
396{
397 rm -f "$screensaver_file".lock
398}
399
400perform_action()
401{
402 result=1
403
404 if [ "$1" = "resume" ] ; then
405 # Restore DPMS state
406 if [ -f "$screensaver_file.dpms" ]; then
407 rm "$screensaver_file.dpms"
408 # Re-enable DPMS
409 xset +dpms
410 fi
411 fi
412 if [ "$1" = "reset" ] ; then
413 if xset -q | grep 'DPMS is Enabled' > /dev/null 2> /dev/null; then
414 xset dpms force on
415 fi
416 fi
417
418 case "$DE" in
419 kde)
420 if [ x"$KDE_SESSION_VERSION" = x"4" ]; then
421 screensaver_freedesktop "$1"
422 else
423 screensaver_kde "$1"
424 fi
425 ;;
426
427 gnome_screensaver)
428 screensaver_gnome_screensaver "$1"
429 ;;
430
431 xscreensaver)
432 screensaver_xscreensaver "$1"
433 ;;
434
435 '')
436 screensaver_xserver "$1"
437 ;;
438
439 '')
440 screensaver_xserver "$1"
441 ;;
442 esac
443
444 if [ "$1" = "suspend" ] ; then
445 # Save DPMS state
446 if xset -q | grep 'DPMS is Enabled' > /dev/null 2> /dev/null; then
447 test "${TMPDIR+set}" = set || TMPDIR=/tmp
448 tmpfile=`mktemp $TMPDIR/tmp.XXXXXXXXXX`
449 $MV "$tmpfile" "$screensaver_file.dpms"
450 # Disable DPMS
451 xset -dpms
452 fi
453 fi
454
455}
456
457cleanup_suspend()
458{
459 lockfile
460 test "${TMPDIR+set}" = set || TMPDIR=/tmp
461 tmpfile=`mktemp $TMPDIR/tmp.XXXXXXXXXX`
462 grep -v "$window_id:$xprop_pid\$" "$screensaver_file" > "$tmpfile" 2> /dev/null
463 $MV "$tmpfile" "$screensaver_file"
464 if [ ! -s "$screensaver_file" ] ; then
465 rm "$screensaver_file"
466 unlockfile
467 # $screensaver_file is empty, do resume
468 perform_action resume
469 else
470 unlockfile
471 fi
472}
473
474do_resume()
475{
476 lockfile # Obtain lockfile
477 # Find the PID of the trackingprocess
478 xprop_pid=`grep "$window_id:" "$screensaver_file" 2> /dev/null | cut -d ':' -f 2`
479 unlockfile # Free lockfile
480 if [ -n "$xprop_pid" ] && ps -p "$xprop_pid" 2> /dev/null | grep xprop > /dev/null; then
481 # Kill the tracking process
482 kill -s TERM $xprop_pid
483 fi
484 cleanup_suspend
485}
486
487XPROP=`which xprop 2> /dev/null`
488
489check_window_id()
490{
491 if [ -z "$XPROP" ]; then
492 DEBUG 3 "xprop not found"
493 return
494 fi
495 DEBUG 2 "Running $XPROP -id $window_id"
496 if $XPROP -id $window_id > /dev/null 2> /dev/null; then
497 DEBUG 3 Window $window_id exists
498 else
499 DEBUG 3 Window $window_id does not exist
500 exit_failure_operation_failed "Window $window_id does not exist"
501 fi
502}
503
504track_window()
505{
506 if [ -z "$XPROP" ]; then
507 # Don't track window if we don't have xprop
508 return
509 fi
510 lockfile
511
512 test "${TMPDIR+set}" = set || TMPDIR=/tmp
513 tmpfile=`mktemp $TMPDIR/tmp.XXXXXXXXXX`
514 # Filter stale entries from the xdg-screensaver status file
515 # Return if $window_id is being tracked already
516 (
517 already_tracked=1
518 IFS_save="$IFS"
519 IFS=":"
520 while read wid pid; do
521 if ps -p "$pid" 2> /dev/null | grep xprop > /dev/null; then
522 echo "$wid:$pid"
523 if [ $wid = $window_id ] ; then
524 already_tracked=0
525 fi
526 fi
527 done
528 IFS="$IFS_save"
529 exit $already_tracked
530 ) < $screensaver_file > $tmpfile
531 already_tracked=$?
532
533 if [ "$already_tracked" -eq "0" ] ; then
534 $MV "$tmpfile" "$screensaver_file"
535 # We are already tracking $window_id, don't do anything
536 unlockfile
537 return
538 fi
539
540 # Start tracking $window_id
541 $XPROP -id $window_id -spy > /dev/null &
542 xprop_pid=$!
543 # Add window_id and xprop_pid to the xdg-screensave status file
544 echo "$window_id:$xprop_pid" >> $tmpfile
545 $MV "$tmpfile" "$screensaver_file"
546 unlockfile
547 # Wait for xprop to edit, it means that the window disappeared
548 wait $xprop_pid
549 # Clean up the administration and resume the screensaver
550 cleanup_suspend
551}
552
553screensaver_freedesktop()
554{
555 case "$1" in
556 suspend)
557 dbus-send --session \
558 --dest=org.freedesktop.ScreenSaver \
559 --type=method_call \
560 --print-reply \
561 --reply-timeout=2000 \
562 /ScreenSaver \
563 org.freedesktop.ScreenSaver.Inhibit \
564 string:$window_id \
565 string:xdg-screensaver \
566 | grep uint32 | cut -d ' ' -f 5 >| "$screensaver_file.cookie" \
567 2> /dev/null
568 result=$?
569 ;;
570
571 resume)
572 if [ -f "$screensaver_file.cookie" ] ; then
573 value=`cat "$screensaver_file.cookie"`
574 dbus-send --session \
575 --dest=org.freedesktop.ScreenSaver \
576 --type=method_call \
577 /ScreenSaver \
578 org.freedesktop.ScreenSaver.UnInhibit \
579 uint32:$value \
580 2> /dev/null
581 rm -f "$screensaver_file.cookie"
582 fi
583 result=$?
584 ;;
585
586 activate)
587 dbus-send --session \
588 --dest=org.freedesktop.ScreenSaver \
589 --type=method_call \
590 /ScreenSaver \
591 org.freedesktop.ScreenSaver.SetActive \
592 boolean:true \
593 2> /dev/null
594 result=$?
595 ;;
596
597 lock)
598 dbus-send --session \
599 --dest=org.freedesktop.ScreenSaver \
600 --type=method_call \
601 /ScreenSaver \
602 org.freedesktop.ScreenSaver.Lock \
603 2> /dev/null
604 ;;
605
606 reset)
607 if [ -f "$screensaver_file.cookie" ] ; then
608 value=`cat "$screensaver_file.cookie"`
609 dbus-send --session \
610 --dest=org.freedesktop.ScreenSaver \
611 --type=method_call \
612 /ScreenSaver \
613 org.freedesktop.ScreenSaver.UnInhibit \
614 uint32:$value \
615 2> /dev/null
616 rm -f "$screensaver_file.cookie"
617 fi
618 result=$?
619 ;;
620
621 status)
622 status=`dbus-send --session \
623 --dest=org.freedesktop.ScreenSaver \
624 --type=method_call \
625 --print-reply \
626 --reply-timeout=2000 \
627 /ScreenSaver \
628 org.freedesktop.ScreenSaver.GetActive \
629 | grep boolean | cut -d ' ' -f 5`
630 result=$?
631 if [ x"$status" = "xtrue" ]; then
632 echo "enabled"
633 elif [ x"$status" = "xfalse" ]; then
634 echo "disabled"
635 else
636 echo "ERROR: dbus org.freedesktop.ScreenSaver.GetActive returned '$status'" >&2
637 return 1
638 fi
639 ;;
640
641 *)
642 echo "ERROR: Unknown command '$1'" >&2
643 return 1
644 ;;
645 esac
646}
647
648screensaver_kde()
649{
650 case "$1" in
651 suspend)
652 dcop kdesktop KScreensaverIface enable false > /dev/null
653 result=$?
654 ;;
655
656 resume)
657 dcop kdesktop KScreensaverIface configure > /dev/null
658 result=$?
659 ;;
660
661 activate)
662 dcop kdesktop KScreensaverIface save > /dev/null
663 result=$?
664 ;;
665
666 lock)
667 dcop kdesktop KScreensaverIface lock > /dev/null
668 result=$?
669 ;;
670
671 reset)
672 # Turns the screensaver off right now
673 dcop kdesktop KScreensaverIface quit > /dev/null
674 result=$?
675 ;;
676
677 status)
678 status=`dcop kdesktop KScreensaverIface isEnabled`
679 result=$?
680 if [ x"$status" = "xtrue" ]; then
681 echo "enabled"
682 elif [ x"$status" = "xfalse" ]; then
683 echo "disabled"
684 else
685 echo "ERROR: kdesktop KScreensaverIface isEnabled returned '$status'" >&2
686 return 1
687 fi
688 ;;
689
690 *)
691 echo "ERROR: Unknown command '$1'" >&2
692 return 1
693 ;;
694 esac
695}
696
697screensaver_xserver()
698{
699 case "$1" in
700 suspend)
701 xset s off > /dev/null
702 result=$?
703 ;;
704
705 resume)
706 xset s default > /dev/null
707 result=$?
708 ;;
709
710 activate)
711 xset s activate > /dev/null
712 result=$?
713 ;;
714
715 reset)
716 xset s reset > /dev/null
717 result=$?
718 ;;
719
720 status)
721 timeout=`xset q | sed '/^Screen Saver:/,/^[^ ]/ { s/.*timeout: *\([0-9]*\).*/\1/; t }; d'`
722 result=$?
723 if [ "$timeout" -gt 0 ]; then
724 echo "enabled"
725 elif [ "$timeout" -eq 0 ]; then
726 echo "disabled"
727 else
728 echo "ERROR: xset q did not report the screensaver timeout" >&2
729 return 1
730 fi
731 ;;
732
733 *)
734 echo "ERROR: Unknown command '$1'" >&2
735 return 1
736 ;;
737 esac
738}
739
740screensaver_xserver()
741{
742 case "$1" in
743 suspend)
744 xset s off > /dev/null
745 result=$?
746 ;;
747
748 resume)
749 xset s default > /dev/null
750 result=$?
751 ;;
752
753 activate)
754 xset s activate > /dev/null
755 result=$?
756 ;;
757
758 reset)
759 xset s reset > /dev/null
760 result=$?
761 ;;
762
763 status)
764 timeout=`xset q | sed '/^Screen Saver:/,/^[^ ]/ { s/.*timeout: *\([0-9]*\).*/\1/; t }; d'`
765 result=$?
766 if [ "$timeout" -gt 0 ]; then
767 echo "enabled"
768 elif [ "$timeout" -eq 0 ]; then
769 echo "disabled"
770 else
771 echo "ERROR: xset q did not report the screensaver timeout" >&2
772 return 1
773 fi
774 ;;
775
776 *)
777 echo "ERROR: Unknown command '$1'" >&2
778 return 1
779 ;;
780 esac
781}
782
783screensaver_suspend_loop()
784{
785 lockfile
786 test "${TMPDIR+set}" = set || TMPDIR=/tmp
787 tmpfile=`mktemp $TMPDIR/tmp.XXXXXXXXXX`
788 # Filter stale entries from the xdg-screensaver status file
789 cat "$screensaver_file" 2> /dev/null | (
790 IFS_save="$IFS"
791 IFS=":"
792 while read wid pid; do
793 if ps -p "$pid" 2> /dev/null | grep xprop > /dev/null; then
794 echo "$wid:$pid"
795 fi
796 done
797 IFS="$IFS_save"
798 ) > $tmpfile
799 if [ -s "$tmpfile" ] ; then
800 # Suspend pending, don't do a thing
801 $MV "$tmpfile" "$screensaver_file"
802 unlockfile
803 return
804 fi
805 $MV "$tmpfile" "$screensaver_file"
806 unlockfile
807 (while [ -f "$screensaver_file" ]; do $*; sleep 50; done) > /dev/null 2> /dev/null &
808}
809
810screensaver_gnome_screensaver()
811{
812# DBUS interface for gnome-screensaver
813# http://people.gnome.org/~mccann/gnome-screensaver/docs/gnome-screensaver.html
814 case "$1" in
815 suspend)
816 screensaver_suspend_loop \
817 dbus-send --session \
818 --dest=org.gnome.ScreenSaver \
819 --type=method_call \
820 /org/gnome/ScreenSaver \
821 org.gnome.ScreenSaver.SimulateUserActivity \
822 2> /dev/null
823 result=$?
824 ;;
825
826 resume)
827 # Automatic resume when $screensaver_file disappears
828 result=0
829 ;;
830
831 activate)
832 dbus-send --session \
833 --dest=org.gnome.ScreenSaver \
834 --type=method_call \
835 /org/gnome/ScreenSaver \
836 org.gnome.ScreenSaver.SetActive \
837 boolean:true \
838 2> /dev/null
839 result=$?
840 ;;
841
842 lock)
843 gnome-screensaver-command --lock > /dev/null 2> /dev/null
844 result=$?
845 ;;
846
847 reset)
848 # Turns the screensaver off right now
849 dbus-send --session \
850 --dest=org.gnome.ScreenSaver \
851 --type=method_call \
852 /org/gnome/ScreenSaver \
853 org.gnome.ScreenSaver.SimulateUserActivity \
854 2> /dev/null
855 result=$?
856 ;;
857
858 status)
859 status=`dbus-send --session \
860 --dest=org.gnome.ScreenSaver \
861 --type=method_call \
862 --print-reply \
863 --reply-timeout=2000 \
864 /org/gnome/ScreenSaver \
865 org.gnome.ScreenSaver.GetActive \
866 | grep boolean | cut -d ' ' -f 5`
867 result=$?
868 if [ x"$status" = "xtrue" -o x"$status" = "xfalse" ]; then
869 echo "enabled"
870 elif [ x"$result" != "x0" ]; then
871 echo "ERROR: dbus org.gnome.ScreenSaver.GetActive returned '$status'" >&2
872 return 1
873 else
874 echo "disabled"
875 fi
876 ;;
877
878 *)
879 echo "ERROR: Unknown command '$1" >&2
880 return 1
881 ;;
882 esac
883}
884
885screensaver_xscreensaver()
886{
887 case "$1" in
888 suspend)
889 screensaver_suspend_loop xscreensaver-command -deactivate
890 result=0
891 ;;
892
893 resume)
894 # Automatic resume when $screensaver_file disappears
895 result=0
896 ;;
897
898 activate)
899 xscreensaver-command -activate > /dev/null 2> /dev/null
900 result=$?
901 ;;
902
903 lock)
904 xscreensaver-command -lock > /dev/null 2> /dev/null
905 result=$?
906 ;;
907
908 reset)
909 # Turns the screensaver off right now
910 xscreensaver-command -deactivate > /dev/null 2> /dev/null
911 result=$?
912 ;;
913
914 status)
915 result=0
916 if [ -f "$screensaver_file" ] ; then
917 echo "disabled"
918 else
919 echo "enabled"
920 fi
921 ;;
922
923 *)
924 echo "ERROR: Unknown command '$1" >&2
925 return 1
926 ;;
927 esac
928}
929
930[ x"$1" != x"" ] || exit_failure_syntax
931
932action=
933window_id=
934
935case $1 in
936 suspend)
937 action="$1"
938
939 shift
940
941 if [ -z "$1" ] ; then
942 exit_failure_syntax "WindowID argument missing"
943 fi
944
945 window_id="$1"
946 check_window_id
947 ;;
948
949 resume)
950 action="$1"
951
952 shift
953
954 if [ -z "$1" ] ; then
955 exit_failure_syntax "WindowID argument missing"
956 fi
957
958 window_id="$1"
959 check_window_id
960 ;;
961
962 activate)
963 action="$1"
964 ;;
965
966 lock)
967 action="$1"
968 ;;
969
970 reset)
971 action="$1"
972 ;;
973
974 status)
975 action="$1"
976 ;;
977
978 *)
979 exit_failure_syntax "unknown command '$1'"
980 ;;
981esac
982
983detectDE
984# Consider "xscreensaver" a separate DE
985xscreensaver-command -version 2> /dev/null | grep XScreenSaver > /dev/null && DE="xscreensaver"
986# Consider "gnome-screensaver" a separate DE
987gnome-screensaver-command -q > /dev/null 2>&1 && DE="gnome_screensaver"
988
989if [ "$action" = "resume" ] ; then
990 do_resume
991 exit_success
992fi
993
994perform_action "$action"
995
996if [ "$action" = "suspend" ] ; then
997 # Start tracking $window_id and resume the screensaver once it disappears
998 ( track_window ) 2> /dev/null > /dev/null &
999fi
1000
1001if [ $result -eq 0 ]; then
1002 exit_success
1003else
1004 exit_failure_operation_failed
1005fi
01006
=== modified file 'debian/changelog'
--- debian/changelog 2013-03-20 19:37:26 +0000
+++ debian/changelog 2014-07-16 09:36:41 +0000
@@ -1,3 +1,10 @@
1xdg-utils (1.1.0~rc1-2ubuntu8) UNRELEASED; urgency=medium
2
3 * Add patch xfce-blanking.diff to prevent screenblanking in Xfce when
4 XScreensaver isn't installed/used
5
6 -- Simon Steinbeiss <ochosi@shimmerproject.org> Wed, 16 Jul 2014 11:19:43 +0200
7
1xdg-utils (1.1.0~rc1-2ubuntu7) raring; urgency=low8xdg-utils (1.1.0~rc1-2ubuntu7) raring; urgency=low
29
3 * Mark as Multi-Arch: foreign (Closes: #688681, LP: #1123710)10 * Mark as Multi-Arch: foreign (Closes: #688681, LP: #1123710)
411
=== modified file 'debian/patches/series'
--- debian/patches/series 2011-10-03 16:06:10 +0000
+++ debian/patches/series 2014-07-16 09:36:41 +0000
@@ -11,3 +11,4 @@
11gnome-3.0.diff11gnome-3.0.diff
12lp779156-lubuntu.diff12lp779156-lubuntu.diff
13xdg-screensaver-dbus.patch13xdg-screensaver-dbus.patch
14xfce-blanking.diff
1415
=== added file 'debian/patches/xfce-blanking.diff'
--- debian/patches/xfce-blanking.diff 1970-01-01 00:00:00 +0000
+++ debian/patches/xfce-blanking.diff 2014-07-16 09:36:41 +0000
@@ -0,0 +1,19 @@
1Description: xdg-screensaver should control X11's blanking in Xfce (BR80089)
2Bug: https://bugs.freedesktop.org/show_bug.cgi?id=80089
3Ubuntu-Bug: https://bugs.launchpad.net/ubuntu/+source/xdg-utils/+bug/1309744
4Forwarded: https://bugs.freedesktop.org/attachment.cgi?id=101155
5Author: Simon Steinbeiss
6
7Index: xdg-utils/scripts/xdg-screensaver
8===================================================================
9--- xdg-utils.orig/scripts/xdg-screensaver 2014-07-16 11:17:08.583020000 +0200
10+++ xdg-utils/scripts/xdg-screensaver 2014-07-16 11:17:33.653383192 +0200
11@@ -432,7 +432,7 @@
12 screensaver_xscreensaver "$1"
13 ;;
14
15- '')
16+ xfce)
17 screensaver_xserver "$1"
18 ;;
19
020
=== modified file 'scripts/xdg-screensaver'
--- scripts/xdg-screensaver 2011-10-03 16:06:10 +0000
+++ scripts/xdg-screensaver 2014-07-16 09:36:41 +0000
@@ -432,7 +432,7 @@
432 screensaver_xscreensaver "$1"432 screensaver_xscreensaver "$1"
433 ;;433 ;;
434434
435 '')435 xfce)
436 screensaver_xserver "$1"436 screensaver_xserver "$1"
437 ;;437 ;;
438438

Subscribers

People subscribed via source and target branches