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

Side by Side Diff: scripts/xdg-screensaver

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-open.in ('k') | scripts/xdg-screensaver.in » ('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 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 #-------------------------------------- 328 #--------------------------------------
329 # Checks for known desktop environments 329 # Checks for known desktop environments
330 # set variable DE to the desktop environments name, lowercase 330 # set variable DE to the desktop environments name, lowercase
331 331
332 detectDE() 332 detectDE()
333 { 333 {
334 if [ x"$KDE_FULL_SESSION" = x"true" ]; then DE=kde; 334 if [ x"$KDE_FULL_SESSION" = x"true" ]; then DE=kde;
335 elif [ x"$GNOME_DESKTOP_SESSION_ID" != x"" ]; then DE=gnome; 335 elif [ x"$GNOME_DESKTOP_SESSION_ID" != x"" ]; then DE=gnome;
336 elif `dbus-send --print-reply --dest=org.freedesktop.DBus /org/freedesktop/D Bus org.freedesktop.DBus.GetNameOwner string:org.gnome.SessionManager > /dev/nul l 2>&1` ; then DE=gnome; 336 elif `dbus-send --print-reply --dest=org.freedesktop.DBus /org/freedesktop/D Bus org.freedesktop.DBus.GetNameOwner string:org.gnome.SessionManager > /dev/nul l 2>&1` ; then DE=gnome;
337 elif xprop -root _DT_SAVE_MODE 2> /dev/null | grep ' = \"xfce4\"$' >/dev/nul l 2>&1; then DE=xfce; 337 elif xprop -root _DT_SAVE_MODE 2> /dev/null | grep ' = \"xfce4\"$' >/dev/nul l 2>&1; then DE=xfce;
338 elif [ x"$DESKTOP_SESSION" == x"LXDE" ]; then DE=lxde; 338 fi
339 else DE="" 339
340 if [ x"$DE" = x"" ]; then
341 # fallback to checking $DESKTOP_SESSION
342 case "$DESKTOP_SESSION" in
343 LXDE)
344 DE=lxde;
345 ;;
346 xfce|xfce4)
347 DE=xfce;
348 ;;
349 esac
350 fi
351
352 if [ x"$DE" = x"" ]; then
353 # fallback to uname output for other platforms
354 case "$(uname 2>/dev/null)" in
355 Darwin)
356 DE=darwin;
357 ;;
358 esac
359 fi
360
361 if [ x"$DE" = x"gnome" ]; then
362 # gnome-default-applications-properties is only available in GNOME 2.x
363 # but not in GNOME 3.x
364 which gnome-default-applications-properties 2> /dev/null || DE="gnome3"
340 fi 365 fi
341 } 366 }
342 367
343 #---------------------------------------------------------------------------- 368 #----------------------------------------------------------------------------
344 # kfmclient exec/openURL can give bogus exit value in KDE <= 3.5.4 369 # 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 370 # It also always returns 1 in KDE 3.4 and earlier
346 # Simply return 0 in such case 371 # Simply return 0 in such case
347 372
348 kfmclient_fix_exit_code() 373 kfmclient_fix_exit_code()
349 { 374 {
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
756 unlockfile 781 unlockfile
757 return 782 return
758 fi 783 fi
759 $MV "$tmpfile" "$screensaver_file" 784 $MV "$tmpfile" "$screensaver_file"
760 unlockfile 785 unlockfile
761 (while [ -f "$screensaver_file" ]; do $*; sleep 50; done) > /dev/null 2> /dev/ null & 786 (while [ -f "$screensaver_file" ]; do $*; sleep 50; done) > /dev/null 2> /dev/ null &
762 } 787 }
763 788
764 screensaver_gnome_screensaver() 789 screensaver_gnome_screensaver()
765 { 790 {
766 # TODO 791 # DBUS interface for gnome-screensaver
767 # There seems to be a DBUS interface for gnome-screensaver 792 # http://people.gnome.org/~mccann/gnome-screensaver/docs/gnome-screensaver.html
768 # See http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/2006-April/042579.html and
769 # http://cvs.gnome.org/viewcvs/gnome-screensaver/src/gs-listener-dbus.c?rev=1.36 &view=log
770 # A problem seems to be that Inhibit is tied to the lifetime of the DBUS appname and
771 # this can not be used from a script
772 case "$1" in 793 case "$1" in
773 suspend) 794 suspend)
774 screensaver_suspend_loop gnome-screensaver-command --poke 795 screensaver_suspend_loop \
775 result=0 796 dbus-send --session \
797 --dest=org.gnome.ScreenSaver \
798 --type=method_call \
799 /org/gnome/ScreenSaver \
800 org.gnome.ScreenSaver.SimulateUserActivity \
801 2> /dev/null
802 result=$?
776 ;; 803 ;;
777 804
778 resume) 805 resume)
779 # Automatic resume when $screensaver_file disappears 806 # Automatic resume when $screensaver_file disappears
780 result=0 807 result=0
781 ;; 808 ;;
782 809
783 activate) 810 activate)
784 gnome-screensaver-command --activate > /dev/null 2> /dev/null 811 dbus-send --session \
812 --dest=org.gnome.ScreenSaver \
813 --type=method_call \
814 /org/gnome/ScreenSaver \
815 org.gnome.ScreenSaver.SetActive \
816 boolean:true \
817 2> /dev/null
785 result=$? 818 result=$?
786 ;; 819 ;;
787 820
788 lock) 821 lock)
789 gnome-screensaver-command --lock > /dev/null 2> /dev/null 822 gnome-screensaver-command --lock > /dev/null 2> /dev/null
790 result=$? 823 result=$?
791 ;; 824 ;;
792 825
793 reset) 826 reset)
794 # Turns the screensaver off right now 827 # Turns the screensaver off right now
795 gnome-screensaver-command --deactivate > /dev/null 2> /dev/null 828 dbus-send --session \
829 --dest=org.gnome.ScreenSaver \
830 --type=method_call \
831 /org/gnome/ScreenSaver \
832 org.gnome.ScreenSaver.SimulateUserActivity \
833 2> /dev/null
796 result=$? 834 result=$?
797 ;; 835 ;;
798 836
799 status) 837 status)
800 result=0 838 status=`dbus-send --session \
801 if [ -f "$screensaver_file" ] ; then 839 --dest=org.gnome.ScreenSaver \
802 echo "disabled" 840 --type=method_call \
803 elif gnome-screensaver-command --query > /dev/null 2> /dev/null; then 841 --print-reply \
842 --reply-timeout=2000 \
843 /org/gnome/ScreenSaver \
844 org.gnome.ScreenSaver.GetActive \
845 | grep boolean | cut -d ' ' -f 5`
846 result=$?
847 if [ x"$status" = "xtrue" -o x"$status" = "xfalse" ]; then
804 echo "enabled" 848 echo "enabled"
849 elif [ x"$result" != "x0" ]; then
850 echo "ERROR: dbus org.gnome.ScreenSaver.GetActive returned '$status' " >&2
851 return 1
805 else 852 else
806 # Something is wrong
807 echo "disabled" 853 echo "disabled"
808 fi 854 fi
809 ;; 855 ;;
810 856
811 *) 857 *)
812 echo "ERROR: Unknown command '$1" >&2 858 echo "ERROR: Unknown command '$1" >&2
813 return 1 859 return 1
814 ;; 860 ;;
815 esac 861 esac
816 } 862 }
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
929 if [ "$action" = "suspend" ] ; then 975 if [ "$action" = "suspend" ] ; then
930 # Start tracking $window_id and resume the screensaver once it disappears 976 # Start tracking $window_id and resume the screensaver once it disappears
931 ( track_window ) 2> /dev/null > /dev/null & 977 ( track_window ) 2> /dev/null > /dev/null &
932 fi 978 fi
933 979
934 if [ $result -eq 0 ]; then 980 if [ $result -eq 0 ]; then
935 exit_success 981 exit_success
936 else 982 else
937 exit_failure_operation_failed 983 exit_failure_operation_failed
938 fi 984 fi
OLDNEW
« no previous file with comments | « scripts/xdg-open.in ('k') | scripts/xdg-screensaver.in » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698