3 # script - "xscreensaver.kss"
5 # Author: Shane Smit <shane_smit@calderasystems.com>
7 # Modification History:
8 # [08/23/1999] - Shane Smit: Creation
11 # This script file enables users to use XScreenSaver via the
12 # KDE Display Properties.
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
23 # Locking is turned off by default.
24 lockmode="-no-lock-mode"
30 # This is the name in the list box.
36 # This simply runs xroger 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
43 /usr/X11R6/lib/xscreensaver/xroger -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
50 /usr/X11R6/bin/xscreensaver -no-splash & # daemon must be started
51 /usr/X11R6/bin/xscreensaver-demo # or the setup will produce
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/X11R6/bin/xscreensaver -no-splash -verbose -no-capture-stderr 2> $TEMP_FILE &
61 /usr/X11R6/bin/xscreensaver-command -activate
63 ExitNow=$(grep -E -c unblanking\|already $TEMP_FILE)
64 if [ $ExitNow != 0 ]; then
71 exit # It should never get this far.
75 # echo "Not yet supported"
85 if [ ! -f "/etc/shadow" ]; then
90 # echo "Not yet supported"
97 # echo "Not yet supported"
100 echo "Unknown parameter: $1"
106 if [ -n "$Install" ] ; then
107 rm $HOME/.kss-preview* # Remove old preview files
108 PID_FILE=$HOME/.kss-install.pid.`hostname`
109 kill `cat $PID_FILE` # Kill old screensaver
110 echo "$$" > $PID_FILE # Write PID of this script
111 /usr/X11R6/bin/xscreensaver -no-splash $timeout $lockmode $Nice & # Start XScreenSaver daemon
112 trap "kill $!" SIGTERM # Set these to kill the daemon
113 trap "kill $!" SIGKILL
115 if [ -f "/etc/shadow" ]; then
116 # xscreensaver is run as the user, which has no access to the /etc/shadow file. Other
117 # .kss screensavers use kcheckpass, which would have to be hacked into xscreensaver to
118 # work correctly. This just activates the screensaver with no password lock.
119 trap "/usr/X11R6/bin/xscreensaver-command -activate" SIGUSR1
121 # xscreensaver can be locked, because it can read the /etc/passwd file.
122 trap "/usr/X11R6/bin/xscreensaver-command -lock" SIGUSR1
125 wait $! # Do not exit, just wait for signals.
128 echo "Usage: ./xscreensaver.kss -install|-setup|-test|-desc [-delay num] [-lock] [-nice num]"
129 # echo " -corners xxxx Placing cursor in corner performs action:"
130 # echo " x = i no action (ignore)"
131 # echo " x = s save screen"
132 # echo " x = l lock screen"
133 # echo " order: top-left, top-right, bottom-left, bottom-right"
134 echo " -delay num Amount of idle time before screen saver starts (default 10min)"
135 echo " -desc Print the screen saver's description to stdout"
136 echo " -install Install screen saver"
137 echo " -lock Require password to stop screen saver"
138 # echo " -allow-root Accept root password to unlock"
139 echo " -nice num Run with specified nice value"
140 echo " -preview wid Run in the specified XWindow"
141 # echo " -inroot Run in the root window"
142 echo " -setup Setup screen saver"
143 echo " -test Invoke the screen saver immediately"
146 # End of script - "xscreensaver.kss"