Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(408)

Side by Side Diff: scripts/xdg-screensaver.in

Issue 6735024: Linux: update xdg-utils again, and check in the built versions of the scripts. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/xdg-utils/
Patch Set: Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « scripts/xdg-screensaver ('k') | scripts/xdg-settings » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/bin/sh 1 #!/bin/sh
2 #--------------------------------------------- 2 #---------------------------------------------
3 # xdg-screensaver 3 # xdg-screensaver
4 # 4 #
5 # Utility script to control screensaver. 5 # Utility script to control screensaver.
6 # 6 #
7 # Refer to the usage() function below for usage. 7 # Refer to the usage() function below for usage.
8 # 8 #
9 # Copyright 2006, Bryce Harrington <bryce@osdl.org> 9 # Copyright 2006, Bryce Harrington <bryce@osdl.org>
10 # 10 #
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 unlockfile 424 unlockfile
425 return 425 return
426 fi 426 fi
427 $MV "$tmpfile" "$screensaver_file" 427 $MV "$tmpfile" "$screensaver_file"
428 unlockfile 428 unlockfile
429 (while [ -f "$screensaver_file" ]; do $*; sleep 50; done) > /dev/null 2> /dev/ null & 429 (while [ -f "$screensaver_file" ]; do $*; sleep 50; done) > /dev/null 2> /dev/ null &
430 } 430 }
431 431
432 screensaver_gnome_screensaver() 432 screensaver_gnome_screensaver()
433 { 433 {
434 # TODO 434 # DBUS interface for gnome-screensaver
435 # There seems to be a DBUS interface for gnome-screensaver 435 # http://people.gnome.org/~mccann/gnome-screensaver/docs/gnome-screensaver.html
436 # See http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/2006-April/042579.html and
437 # http://cvs.gnome.org/viewcvs/gnome-screensaver/src/gs-listener-dbus.c?rev=1.36 &view=log
438 # A problem seems to be that Inhibit is tied to the lifetime of the DBUS appname and
439 # this can not be used from a script
440 case "$1" in 436 case "$1" in
441 suspend) 437 suspend)
442 screensaver_suspend_loop gnome-screensaver-command --poke 438 screensaver_suspend_loop \
443 result=0 439 dbus-send --session \
440 --dest=org.gnome.ScreenSaver \
441 --type=method_call \
442 /org/gnome/ScreenSaver \
443 org.gnome.ScreenSaver.SimulateUserActivity \
444 2> /dev/null
445 result=$?
444 ;; 446 ;;
445 447
446 resume) 448 resume)
447 # Automatic resume when $screensaver_file disappears 449 # Automatic resume when $screensaver_file disappears
448 result=0 450 result=0
449 ;; 451 ;;
450 452
451 activate) 453 activate)
452 gnome-screensaver-command --activate > /dev/null 2> /dev/null 454 dbus-send --session \
455 --dest=org.gnome.ScreenSaver \
456 --type=method_call \
457 /org/gnome/ScreenSaver \
458 org.gnome.ScreenSaver.SetActive \
459 boolean:true \
460 2> /dev/null
453 result=$? 461 result=$?
454 ;; 462 ;;
455 463
456 lock) 464 lock)
457 gnome-screensaver-command --lock > /dev/null 2> /dev/null 465 gnome-screensaver-command --lock > /dev/null 2> /dev/null
458 result=$? 466 result=$?
459 ;; 467 ;;
460 468
461 reset) 469 reset)
462 # Turns the screensaver off right now 470 # Turns the screensaver off right now
463 gnome-screensaver-command --deactivate > /dev/null 2> /dev/null 471 dbus-send --session \
472 --dest=org.gnome.ScreenSaver \
473 --type=method_call \
474 /org/gnome/ScreenSaver \
475 org.gnome.ScreenSaver.SimulateUserActivity \
476 2> /dev/null
464 result=$? 477 result=$?
465 ;; 478 ;;
466 479
467 status) 480 status)
468 result=0 481 status=`dbus-send --session \
469 if [ -f "$screensaver_file" ] ; then 482 --dest=org.gnome.ScreenSaver \
470 echo "disabled" 483 --type=method_call \
471 elif gnome-screensaver-command --query > /dev/null 2> /dev/null; then 484 --print-reply \
485 --reply-timeout=2000 \
486 /org/gnome/ScreenSaver \
487 org.gnome.ScreenSaver.GetActive \
488 | grep boolean | cut -d ' ' -f 5`
489 result=$?
490 if [ x"$status" = "xtrue" -o x"$status" = "xfalse" ]; then
472 echo "enabled" 491 echo "enabled"
492 elif [ x"$result" != "x0" ]; then
493 echo "ERROR: dbus org.gnome.ScreenSaver.GetActive returned '$status' " >&2
494 return 1
473 else 495 else
474 # Something is wrong
475 echo "disabled" 496 echo "disabled"
476 fi 497 fi
477 ;; 498 ;;
478 499
479 *) 500 *)
480 echo "ERROR: Unknown command '$1" >&2 501 echo "ERROR: Unknown command '$1" >&2
481 return 1 502 return 1
482 ;; 503 ;;
483 esac 504 esac
484 } 505 }
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
597 if [ "$action" = "suspend" ] ; then 618 if [ "$action" = "suspend" ] ; then
598 # Start tracking $window_id and resume the screensaver once it disappears 619 # Start tracking $window_id and resume the screensaver once it disappears
599 ( track_window ) 2> /dev/null > /dev/null & 620 ( track_window ) 2> /dev/null > /dev/null &
600 fi 621 fi
601 622
602 if [ $result -eq 0 ]; then 623 if [ $result -eq 0 ]; then
603 exit_success 624 exit_success
604 else 625 else
605 exit_failure_operation_failed 626 exit_failure_operation_failed
606 fi 627 fi
OLDNEW
« no previous file with comments | « scripts/xdg-screensaver ('k') | scripts/xdg-settings » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698