#!/usr/bin/perl # Script: # Customized Random Xlock Screensaver # # Starts a random xlock screensaver, choosing from an assortment # of your favorites, and using whatever additional custom command # line options you like. # # # by Apollia of Astroblahhh.Com - http://astroblahhh.com/ # Completed 7/14/2012. Public domain. # # # Definitely works in Lucid Puppy Linux 5.2.8. Might work with other # Linuxes, perhaps with slight modifications. # # For Lucid Puppy 5.2.8 users (and others), this script is a nice # alternative to the "lock" icon on the desktop, since this script # gives you random screensavers and is more customizable. For example, # no more horrible bright white password screen (unless you want that). # # ###################################################################### ###################################################################### # # Instructions # # First, if this script is named "customized-random-xlock-screensaver.txt", # rename it to something else, like "customized-random-xlock-screensaver.pl", # though even a name without .pl after it should work, like # "Random Screensaver". # # (In Rox-Filer, you can rename files by right-clicking on them, going # to the "File '[name of the file you right-clicked on]'" menu, and # choosing Rename. Be careful to edit only the file name and not the # file path, because, annoyingly, the Rename function of Rox can do more # than just rename files - it can actually move files around if you change # the file path.) # # # You will most likely have to give this script Exec permissions to make # it possible to run this script just by double-clicking on it. # # In Lucid Puppy 5.2, if this script is on a disk or partition in NTFS # or FAT format (formats Windows likes), you might be able to make this # script executable simply by renaming this script to something that # doesn't end in .txt. # # But if this script is on a drive or partition in a Linux format like ext2, # you'll have to do a bit more to grant Exec permissions to this script. # Here's one way to do it: # # In Rox-Filer, right-click this customized-random-xlock-screensaver.pl script, # go to the "File 'customized-random-xlock-screensaver.pl'" menu, and choose # Properties. Then, put a check in the checkbox across from Owner and under # Exec, and click Close. # # # Now, to run this script, you should be able to just double-click on it. # But before you do, you'll probably want to customize the script a little. # # To do that, open the script in a text editor. (In Lucid Puppy 5.2.8, by # default, there is an "edit" icon on the desktop which will open a # text editor named Geany.) # # Then, follow the instructions below. There are 5 main steps. ################################ # # Constants for readability # (Don't change these.) use constant false => 0; use constant true => 1; # # End of Constants for readability # ################################# ###################################################################### # # Step 1. Decide whether you want a password screen to appear # whenever the screensaver is interrupted. # ------------------------------------------------------------ $display_password_screen = false; # Set this to true or false. ###################################################################### # # Step 2. Put in an encrypted password. # -------------------------------------- $encrypted_password = "v8YmyOBnZrfIc"; # Example encrypted password: # $encrypted_password = "v8YmyOBnZrfIc"; # Equivalent to "password". # # The encrypted password you put here will cause any encrypted # password stored in /root/.xlockrc to be ignored. # # # I'm not sure how to generate encrypted xlock passwords, other # than by this method: # # In Lucid Puppy 5.2.8, you can click the "lock" icon on the # desktop and you will be asked to create a password. Do so, # and the file /root/.xlockrc (which contains your encrypted # password) will be created. # # Then, you can open /root/.xlockrc in a text editor, and copy # and paste its contents in between the quotes after # $encrypted_password. ###################################################################### # # Step 3. If necessary/desired, change the root user's password. # -------------------------------------------------------------- # Warning! # # In Lucid Puppy 5.2.8 (and likely other Puppies), xlock will accept # not only the password you configured xlock to accept, but also the # root user's password, which is "woofwoof" by default in Puppy Linux. # # As far as I know, there is no way to stop xlock in Lucid Puppy 5.2.8 # from accepting the root password. I assume other Linuxes might have # the same problem. # # So, for better security with xlock, you might need to change the # root user's password. # # # In Lucid Puppy 5.2.8, that can be done by opening a terminal and # typing "passwd", then entering a new password at the prompt. # # Once you do, the new password will be stored in some strange format # in the following file: # # /etc/shadow # # Another way to change the root user's password is by overwriting # that file with a different /etc/shadow file. So, that's one way # you can skip having to run the "passwd" command. # ###################################################################### # # Step 4. Customize the array of screensaver modes. # ------------------------------------------------- # # In the @screensavers array, put whatever screensaver modes you like. # You can add as many as you want. @screensavers = ("dclock -time24", "dclock -led -time24", "spiral"); # Example arrays: # @screensavers = ("dclock -time24", "dclock -led -time24", "spiral"); # @screensavers = ("random"); # @screensavers = ("blank"); # # # Here are all screensaver modes available in xlock in Lucid Puppy 5.2.8: # # "ball", "dclock", "goop", "lyapunov", "mandelbrot", "matrix", # "penrose", "solitaire", "spiral", "blank", "random" # # For more options you can use with those modes, see below for # Lucid Puppy 5.2.8's xlock documentation. # # # xlock in other Linuxes might have more modes and options. # # In any Linux, to see your xlock's built-in documentation, # type "xlock -help" (without quotes) in a terminal. # # # # xlock -help's # Documentation of -mode Options # Copied and pasted from Lucid Puppy 5.2.8 # # Different, more extensive xlock options might be available # in other Linuxes. For example: http://linux.die.net/man/1/xlock # # To see your xlock's built-in documentation, type # "xlock -help" (without quotes) in a terminal. # # --------------------------------------------- # # -mode mode animation mode # where mode is one of: # ball Shows bouncing balls # dclock Shows a floating digital clock or message # -/+binary turn on/off binary clock display # -/+led turn on/off Light Emitting Diode seven segment display # -/+popex turn on/off population explosion counter # -/+forest turn on/off tropical forest destruction counter # -/+hiv turn on/off HIV infection counter # -/+lab turn on/off Animal Research counter # -/+veg turn on/off Animal Consumation counter # -/+time24 turn on/off 24 hour display # -/+y2k turn on/off Year 2000 countdown # -/+millennium turn on/off 3rd Millennium (1 January 2001) countdown # goop Shows goop from a lava lamp # lyapunov Shows lyapunov space # -/+cycle turn on/off colour cycling # mandelbrot Shows mandelbrot sets # -increment value increasing orders # -/+binary turn on/off Binary Decomposition colour modulation # -/+dem turn on/off Distance Estimator Method (instead of escape time) # -/+lyap render interior with Lyapunov measure # -/+alpha render interior with Alpha level sets # -/+index render interior with Alpha indexes # -/+pow turn on/off adding z^z # -/+sin turn on/off adding sin(z) # -/+cycle turn on/off colour cycling # matrix Shows the Matrix # penrose Shows Penrose's quasiperiodic tilings # -/+ammann turn on/off Ammann lines # solitaire Shows Klondike's game of solitaire # -/+trackmouse turn on/off the tracking of the mouse # spiral Shows a helical locus of points # blank Shows nothing but a black screen # random Shows a random mode (except blank) # -duration num how long a mode runs before changing to another # -modelist string list of modes to randomly choose from # -/+sequential turn on/off picking of modes sequentially # -/+fullrandom turn on/off full random choice of mode-options # # ###################################################################### # # Step 5. Optionally, customize other command line options. # --------------------------------------------------------- # # Here, you can put any custom command line options you want to use # (other than -mode, -nolock/+nolock, or -cpasswd). # # To see what options you can use in Lucid Puppy 5.2.8, see # copied-and-pasted xlock documentation a bit further below. # # Or, in any Linux, to see your xlock's built-in documentation, # type "xlock -help" (without quotes) in a terminal. $more_command_line_options = "-bg black -fg green -erasetime 1 -saturation .7 -ncolors 200"; ##################################################################### # # Apollia's Brief Notes # on the Example Command Line Options # # (These notes apply to xlock in Lucid Puppy 5.2.8.) # # Example command line options: # $more_command_line_options = "-bg black -fg green -erasetime 1 -saturation .7 -ncolors 200"; # ---------------------------------------------------- # # No need to add -nolock manually to get rid of the password screen - # just set the $display_password_screen variable near the top of the # script to false, and -nolock will be added automatically. # # # * -bg sets the background color of the password screen. # * -fg sets the foreground color of the password screen. # # I don't know what color names xlock understands. xlock seemingly # doesn't even mind words like "fork" and "spoon" as color names. :-) # # * -erasetime 1 sets the time taken to erase the screen and go # go to the password screen to 1 second. # # * -ncolors 200 sets the maximum number of colors to 200 (as high # as possible). # # * -saturation .7 makes the colors 70% of how saturated they can # possibly get. The less saturation, the more pastel or pale # the colors get. # # Valid values are from... # # 0.0 - Least saturated, white or close to it. # to # 1.0 - Most saturated. Very bright colors. # # ###################################################################### # # xlock -help's Documentation # Except -mode options. (For those, see comments above # in Step 4 section of this script.) # # Copied and pasted from Lucid Puppy 5.2.8. # # Different, more extensive xlock options might be available # in other Linuxes. For example: http://linux.die.net/man/1/xlock # # To see your xlock's built-in documentation, type # "xlock -help" (without quotes) in a terminal. # --------------------------------------------- # # usage: # xlock [-options ...] # # where options include: # -help print out this message to standard output # -version print version number (if >= 4.00) to standard output # -resources print default resource file to standard output # -display displayname X server to contact # -visual visualname X visual to use # -parent parent window id (for inwindow) # -name resourcename class name to use for resources (default is XLock) # -delay usecs microsecond delay between screen updates # -batchcount num number of things per batch (deprecated) # -count num number of things per batch # -cycles num number of cycles per batch # -size num size of a unit in a mode, default is 0 # -ncolors num maximum number of colors, default is 64 # -saturation value saturation of color ramp # -bitmap filename bitmap file (sometimes xpm and ras too) # -erasemode erase-modename Erase mode to use (to ddisable set to no_fade) # -erasedelay num Erase delay for clear screen modes # -erasetime num Maximum time (sec) to be used by erase # -/+nolock turn on/off no password required # -/+inwindow turn on/off making xlock run in a window # -/+inroot turn on/off making xlock run in the root window # -/+remote turn on/off remote host access # -/+mono turn on/off monochrome override # -/+allowaccess turn on/off allow new clients to connect # -/+allowroot turn on/off allow root password to unlock (off ignored) # -/+debug whether to use debug xlock (yes/no) # -/+description whether to show mode description (yes/no) # -/+echokeys turn on/off echo '?' for each password key # -echokey char text character to use for echo key, default is '?' # -/+enablesaver turn on/off enable X server screen saver # -/+resetsaver turn on/off resetting of X server screen saver # -/+grabmouse turn on/off grabbing of mouse and keyboard # -/+grabserver turn on/off grabbing of server # -/+install whether to use private colormap if needed (yes/no) # -/+hide turn on/off user background manipulation # -/+mousemotion turn on/off sensitivity to mouse # -/+sound whether to use sound if configured for it (yes/no) # -/+showdate turn on/off date in password window # -/+timeelapsed turn on/off clock # -/+usefirst turn on/off using the first char typed in password # -/+verbose turn on/off verbosity # -nice level nice level for xlock process # -lockdelay seconds number of seconds until lock # -unlockdelay seconds number of seconds until unlock # -timeout seconds number of seconds before password times out # -font fontname font to use for password prompt # -planfont fontname font to use for plan message # -bg color background color to use for password prompt # -fg color foreground color to use for password prompt # -background color background color to use for password prompt # -foreground color foreground color to use for password prompt # -username string text string to use for Name prompt # -password string text string to use for Password prompt # -info string text string to use for instructions # -validate string text string to use for validating password message # -invalid string text string to use for invalid password message # -invalidCapsLock string text string to use for invalid password message with Caps Lock on # -geometry geom geometry for non-full screen lock # -icongeometry geom geometry for password window (location ignored) # -/+wireframe turn on/off wireframe # -/+use3d turn on/off 3d view # -delta3d value space between the center of your 2 eyes for 3d mode # -none3d color color to be used for null in 3d mode # -right3d color color to be used for the right eye in 3d mode # -left3d color color to be used for the left eye in 3d mode # -both3d color color to be used overlap in 3d mode # -program programname program to get messages from, usually fortune # -messagesfile formatted-filename formatted file of fortunes # -messagefile filename text file for mode # -message string text for mode # -messagefont fontname font for a specific mode # -cpasswd crypted-password text string of encrypted password # -startCmd string command to run at locktime # -endCmd string command to run when unlocking # -pipepassCmd string command into which to pipe the password when unlocking # -logoutCmd string command to run when automatically logging out # -mailCmd string command to run to check for mail # -mailIcon string Icon to display when there is mail # -nomailIcon string Icon to display when there is no mail # -dpmsstandby seconds seconds to wait before engaging DPMS standby # -dpmssuspend seconds seconds to wait before engaging DPMS suspend # -dpmsoff seconds seconds to wait before engaging DPMS of # # ###################################################################### # # Nothing below here needs to be altered. # $number_of_items_in_screensavers_array = scalar(@screensavers); $random_screensaver = int( rand( $number_of_items_in_screensavers_array ) ); if ($display_password_screen==true) { $lock_or_not="+nolock"; } else { $lock_or_not="-nolock"; } $command_line = "xlock " . $more_command_line_options . " -cpasswd $encrypted_password $lock_or_not -mode " . $screensavers[$random_screensaver]; print "\n# $command_line\n\n"; exec ($command_line);