This is ss.sh in view mode; [Download] [Up]
#!/bin/sh ###################################################### # Timothy J. Luoma -- 07 Feb 1996 # No guarantees expressed or implied # brings the screen down, waits for a key to be # pressed, then brings the screen back to its previous # level. # Requires: VidLev and setdimlevel to be in your $PATH # they were included in this distribution. # Motivation: I had two scripts (dimdown and scup) # which did this same thing, but I had to type in # 'scup' and hit return while the screen was black. # Needless to say, I mistyped it a lot. So now all # I have to do is hit any key and the screen will # come back. # # I've got no scientific proof that this will make # your monitor last any longer than running a blank # screen. However, this is an easy way to dim and # restore the screen. Also, this script restores # the brightness gradually. Again, I don't have # any PROOF that this is better than a screen saver # that immediately makes the screen bright again, # but it seems to make sense to me that gradual is # better. ###################################################### # set the current brightness level # need to set two variables, one to change and one # to leave alone prefer=`VidLev -t` restore=$prefer # bring the screen brightness down quickly and gently byfive=`expr $prefer / 5` while [ "$byfive" != 0 ] do prefer=`expr $prefer - 5` setdimlevel $prefer byfive=`expr $byfive - 1` done setdimlevel 0 #### end of dimming cycle #### ###################################################### ###################################################### # this code is just here to tell the script to wait # for any key stroke to return the screen to its # previous brightness level. stty cbreak readchar=`dd if=/dev/tty bs=1 count=1 2>/dev/null` stty -cbreak ###################################################### ##### restore screen brightness #### # give it a little head-start... makes the brightening # seem like it doesn't take so long setdimlevel 10 # initialize $current current=`VidLev -t` while [ "$current" -lt "$restore" ] do current=`/bin/expr $current + 5` setdimlevel $current done # make sure that the level gets to be exactly what # it was before we began setdimlevel $restore echo "Current is `VidLev -t`" #end
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.