Diff: WindowMakerThemes

Differences between version 2 and predecessor to the previous major change of WindowMakerThemes.

Other diffs: Previous Revision, Previous Author

Newer page: version 2 Last edited on April 29, 2003 5:37 pm by PhilHollenback Revert
Older page: version 1 Last edited on March 26, 2002 5:30 pm by PhilHollenback Revert
@@ -1,36 +1,64 @@
 The ~WindowMaker window manager has a theme mechanisim which controls your background images, titlebar images, etc. This is controlled with the setstyle program. 
  
 I wrote the following script to invoke setstyle and give it a random theme: 
 <verbatim> 
- #!/usr/bin/tcl  
- # A script to randomly select a new windowmaker theme. 
+#!/usr/bin/tcl  
+# A script to randomly select a new windowmaker theme. 
  
- set dir "~/GNUstep/Library/WindowMaker/Themes"  
- set styleprog /usr/local /bin /setstyle  
+# Phil Hollenback  
+# philiph_at_pobox.com  
+# 4 /29 /03  
  
- set themelist [ readdir $dir
+set Background [ lindex $argv 0 ]  
+set ScriptName [ file tail $argv0
  
- # Pick a random theme from the list.  
- random seed  
- set picknum [ random [ llength $themelist ] ]  
- set theme [ lindex $themelist $picknum
+set dir "~/GNUstep/Library/WindowMaker/Themes"  
+set styleprog /usr/X11R6/bin/setstyle  
+set SleepTime 3600  
+set themelist [ readdir $dir
  
- #echo "theme is $theme"  
  
- if [ file exists "$dir/$theme" ] { 
+proc PrintUsage {} {  
+ global ScriptName SleepTime  
+ puts "Usage: $ScriptName \[-b\]"  
+ puts "optional b switch causes program to stay running and wake up every $SleepTime"  
+ puts "seconds to change the background."  
+}  
+  
+if { $argc > 1 } {  
+ PrintUsage  
+ exit 1  
+}  
+  
+# Pick a random theme from the list.  
+random seed  
+set picknum [ random [ llength $themelist ] ]  
+set theme [ lindex $themelist $picknum ]  
+  
+#echo "theme is $theme"  
+  
+ if [ file exists "$dir/$theme" ] { 
  set result [system $styleprog $dir/"$theme"] 
  if [ expr $result != 0 ] { 
- echo "$styleprog failed!"  
- echo "Theme was $dir/$theme" 
+ puts stderr "$styleprog failed!"  
+ puts stderr "Theme was $dir/$theme" 
  exit 1 
 
- exit 0  
- } else { 
+ if { [ string compare $Background "-b" ] != 0 } {  
+ # quit unless user specified "-b" persistent switch.  
+ exit 0  
+ }  
+} else { 
  echo "Can't find theme $dir/$theme! Where did it go?" 
  exit 1 
-
+}  
+  
+# Sleep for a while, then respawn to change the background again.  
+sleep $SleepTime  
+execl $argv0  
+  
 </verbatim> 
  
-So throw that in a cronjob and you get a new random theme every half-hour . Pretty cool
+To use this script, start it in your .xsession or .startxrc with the -b switch. It will then change the theme every 30 minutes . If you call it without the -b switch, it changes the theme immediately and exits
  
 --phil 3/7/02 

version 2

The WindowMaker window manager has a theme mechanisim which controls your background images, titlebar images, etc. This is controlled with the setstyle program.

I wrote the following script to invoke setstyle and give it a random theme:

#!/usr/bin/tcl
# A script to randomly select a new windowmaker theme.

# Phil Hollenback
# philiph_at_pobox.com
# 4/29/03

set Background [ lindex $argv 0 ]
set ScriptName [ file tail $argv0 ]

set dir "~/GNUstep/Library/WindowMaker/Themes"
set styleprog /usr/X11R6/bin/setstyle
set SleepTime 3600
set themelist [ readdir $dir ]


proc PrintUsage {} {
    global ScriptName SleepTime
    puts "Usage: $ScriptName \[-b\]"
    puts "optional b switch causes program to stay running and wake up every $SleepTime"
    puts "seconds to change the background."
}

if { $argc > 1 } {
    PrintUsage
    exit 1
}

# Pick a random theme from the list.
random seed
set picknum [ random [ llength $themelist ] ]
set theme [ lindex $themelist $picknum ]

#echo "theme is $theme"

if [ file exists "$dir/$theme" ] {
    set result [system $styleprog $dir/"$theme"]
    if [ expr $result != 0 ] {
      puts stderr "$styleprog failed!"
      puts stderr "Theme was $dir/$theme"
      exit 1
    }
    if { [ string compare $Background "-b" ] != 0 } {
        # quit unless user specified "-b" persistent switch.
        exit 0
    }
} else {
    echo "Can't find theme $dir/$theme! Where did it go?"
    exit 1
}

# Sleep for a while, then respawn to change the background again.
sleep $SleepTime
execl $argv0

To use this script, start it in your .xsession or .startxrc with the -b switch. It will then change the theme every 30 minutes. If you call it without the -b switch, it changes the theme immediately and exits.

--phil 3/7/02



Our Founder
ToolboxClick to hide/show