~ubuntu-branches/ubuntu/breezy/xscreensaver/breezy

« back to all changes in this revision

Viewing changes to driver/xscreensaver.kss

  • Committer: Bazaar Package Importer
  • Author(s): Oliver Grawert
  • Date: 2005-10-11 21:00:42 UTC
  • mfrom: (2.1.1 sarge)
  • Revision ID: james.westby@ubuntu.com-20051011210042-u7q6zslgevdxspr3
Tags: 4.21-4ubuntu17
updated pt_BR again, fixed to UTF-8 

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/bin/bash -
2
 
 
3
 
# script - "xscreensaver.kss"
4
 
#
5
 
# Author: Shane Smit <shane_smit@calderasystems.com>
6
 
#
7
 
# Modification History:
8
 
#  [08/23/1999] - Shane Smit: Creation
9
 
#
10
 
# Description:
11
 
#  This script file enables users to use XScreenSaver via the
12
 
#  KDE Display Properties. 
13
 
 
14
 
# Permission to use, copy, modify, distribute, and sell this software and its
15
 
# documentation for any purpose is hereby granted without fee, provided that
16
 
# the above copyright notice appear in all copies and that both that
17
 
# copyright notice and this permission notice appear in supporting
18
 
# documentation.  No representations are made about the suitability of this
19
 
# software for any purpose.  It is provided "as is" without express or 
20
 
# implied warranty.
21
 
 
22
 
 
23
 
# Locking is turned off by default.
24
 
lockmode="-no-lock-mode"
25
 
 
26
 
while [ -n "$1" ]; do
27
 
  case "$1" in
28
 
 
29
 
    -desc) 
30
 
      # This is the name in the list box.
31
 
      echo "XScreenSaver"
32
 
      exit
33
 
      ;;
34
 
 
35
 
    -preview)
36
 
      # This simply runs xflame in the preview window.  For this to be "real",
37
 
      # it needs to run xscreensaver with a -window-id parameter for each hack.
38
 
      # There are two ways to do this:
39
 
      # 1) Hack xscreensaver to allow global parameters.
40
 
      # 2) Hack xscreensaver to accept alternate setup files, and create one on
41
 
      #    the fly here.
42
 
      shift
43
 
      /usr/lib/xscreensaver/xflame -delay 1 -window-id $1 &    # Start new preview 
44
 
      echo "$!" > $HOME/.kss-preview$1.pid.`hostname`                # Write PID 
45
 
      wait $!                                                        # Wait for it to get killed
46
 
      exit
47
 
      ;;
48
 
 
49
 
    -setup)
50
 
      /usr/bin/xscreensaver -no-splash &     # daemon must be started
51
 
      /usr/bin/xscreensaver-demo             # or the setup will produce
52
 
      kill $!                                      # a warning.
53
 
      exit
54
 
      ;;
55
 
 
56
 
    -test)
57
 
      # I was unable to grep stdout because xscreensaver nabs it. But I was able
58
 
      # to output it to a file, and grep the file.
59
 
      TEMP_FILE=/tmp/xsc.$RANDOM
60
 
      /usr/bin/xscreensaver -no-splash -verbose -no-capture-stderr 2> $TEMP_FILE &
61
 
      /usr/bin/xscreensaver-command -activate
62
 
      while true; do
63
 
        ExitNow=$(grep -E -c unblanking\|already $TEMP_FILE)
64
 
        if [ $ExitNow != 0 ]; then
65
 
          kill $!
66
 
          rm $TEMP_FILE
67
 
          exit
68
 
        fi
69
 
        sleep 1
70
 
      done
71
 
      exit      # It should never get this far.
72
 
      ;;
73
 
 
74
 
#    -corners)
75
 
#      echo "Not yet supported"
76
 
#      ;;
77
 
    -delay)
78
 
      shift
79
 
      timeout="-timeout $1"
80
 
      ;;
81
 
    -install)
82
 
      Install="TRUE"
83
 
      ;;
84
 
    -lock)
85
 
      if [ ! -f "/etc/shadow" ]; then      
86
 
        lockmode="-lock-mode"
87
 
      fi
88
 
      ;;
89
 
#    -allow-root)
90
 
#      echo "Not yet supported"
91
 
#      ;;
92
 
    -nice)
93
 
      shift
94
 
      Nice="-nice $1"
95
 
      ;;
96
 
#    -inroot)
97
 
#      echo "Not yet supported"
98
 
#      ;;
99
 
    *)
100
 
      echo "Unknown parameter: $1"
101
 
      ;;
102
 
  esac
103
 
  shift
104
 
done
105
 
 
106
 
if [ -n "$Install" ] ; then
107
 
  PID_FILE=$HOME/.kss-install.pid.`hostname`
108
 
  if [ -r "$PID_FILE" ] ; then
109
 
    kill `cat $PID_FILE`                                # Kill old screensaver 
110
 
  fi
111
 
  echo "$$" > $PID_FILE                                 # Write PID of this script
112
 
  /usr/bin/xscreensaver -no-splash $timeout $lockmode $Nice &    # Start XScreenSaver daemon
113
 
  trap "kill $!" SIGTERM                                # Set these to kill the daemon
114
 
  trap "kill $!" SIGKILL
115
 
 
116
 
# KDE sends SIGUSER1 to indicate the user has hit the "lock" button.
117
 
  trap "/usr/bin/xscreensaver-command -lock" SIGUSR1
118
 
 
119
 
  wait $!                                               # Do not exit, just wait for signals.
120
 
 
121
 
else
122
 
  echo "Usage: ./xscreensaver.kss -install|-setup|-test|-desc [-delay num] [-lock] [-nice num]"
123
 
#  echo "  -corners xxxx     Placing cursor in corner performs action:"
124
 
#  echo "                     x = i  no action (ignore)"
125
 
#  echo "                     x = s  save screen"
126
 
#  echo "                     x = l  lock screen"
127
 
#  echo "                    order: top-left, top-right, bottom-left, bottom-right"
128
 
  echo "  -delay num        Amount of idle time before screen saver starts  (default 10min)"
129
 
  echo "  -desc             Print the screen saver's description to stdout"
130
 
  echo "  -install          Install screen saver"
131
 
  echo "  -lock             Require password to stop screen saver"
132
 
#  echo "  -allow-root       Accept root password to unlock"
133
 
  echo "  -nice num         Run with specified nice value"
134
 
  echo "  -preview wid      Run in the specified XWindow"
135
 
#  echo "  -inroot           Run in the root window"
136
 
  echo "  -setup            Setup screen saver"
137
 
  echo "  -test             Invoke the screen saver immediately"
138
 
fi
139
 
 
140
 
# End of script - "xscreensaver.kss"