Tag Archives: systems

Of fortunes and Macs and (Xscreen) savers…

Every so often I have the urge to do something quite unnatural; something like, for instance, actually updating the software on my Macbook…

Rather subversive, I know, but we all have our weaknesses.

One go the packages I make a habit of installing, and updating, is JWZ’s Mac build of Xscreensaver. The biggest down-side of doing that, though, is that, unlike in Linux, it doesn’t by default display quotes from the fortune files.

The ability do so is, of course, still very much there, but the Mac build does not have an easy way of enabling it.

Herewith, then, my workflow to get things back to “sanity” once I’ve upgraded.

Firstly, make sure that you have installed fortune from the ports (or any other way that takes your fancy):

eroux@smaug:~$ sudo port install fortune
--->  Fetching archive for fortune
--->  Fetching fortune
--->  Verifying checksum(s) for fortune
--->  Extracting fortune
--->  Applying patches to fortune
--->  Configuring fortune
--->  Building fortune
--->  Staging fortune into destroot
--->  Installing fortune @6.2.0-RELEASE_0+universal
--->  Activating fortune @6.2.0-RELEASE_0+universal
--->  Cleaning fortune
eroux@smaug:~$ 

Once you can run fortune and get a result, you are ready to continue:

eroux@smaug:~$ fortune
I always had a repulsive need to be something more than human.
                                                -- David Bowie
eroux@smaug:~$ type fortune
fortune is hashed (/opt/local/bin/fortune)
eroux@smaug:~$

Now you need the following patch, which we’ll use to convince Xscreensaver that we know what we’re doing:

eroux@norbert:~$ cat < <EOF >~/xscreensaver-text.patch 
--- xscreensaver-text.pre   2011-03-01 18:06:46.000000000 +0200
+++ xscreensaver-text       2011-03-01 18:07:05.000000000 +0200
@@ -247,6 +247,7 @@
   elsif ($text_mode eq '1') { $text_mode = 'literal'; }
   elsif ($text_mode eq '2') { $text_mode = 'file';    }
   elsif ($text_mode eq '3') { $text_mode = 'url';     }
+  elsif ($text_mode eq '4') { $text_mode = 'program'; }

   $v = get_cocoa_pref_1 ($id, "textLiteral");
   $text_literal = $v if defined ($v);
EOF
eroux@norbert:~$ 

All we’re doing here is adding a program text mode to Xscreensaver, which we will then use via defaults to get fortune to run under its auspices.

Now we need to update all the files that actually could use some fortune:

for I in Apple2 FlipText FontGlide NoseGuy Phosphor StarWars XMatrix; do
    cd "/Library/Screen Savers/${I}.saver/Contents/Resources/" && 
        patch -p0 < ~/xscreensaver-text.patch && cd;
done

Now we get to test one of the screen savers. My favourite is one called Phosphor, so lets start with that:

defaults -currentHost write \
  org.jwz.xscreensaver.Phosphor \
  textProgram "/opt/local/bin/fortune";

This tells Phosphor which program to run, but not yet that it should actually use it. Let’s do that now, why don’t we?

defaults -currentHost write \
  org.jwz.xscreensaver.Phosphor \
  textMode 4;

Here you see us actually using the mode we defined in the patch, earlier. I had to change the scale of the fonts to get the display to fit on my screen, so if it’s too big or too small, you can change that from within the screensaver configuration window.

eroux@smaug:~$ defaults -currentHost read org.jwz.xscreensaver.Phosphor
{
    scale = 3;
    textMode = 4;
    textProgram = "/opt/local/bin/fortune";
}
eroux@smaug:~$

All done… Now you just need to sit back and wait for your screen to lock… Or just press Ctrl-Shift-Eject if you’re too impatient, of course.

Some alternatives to consider: Since the fortune you run is the same program you would find on any Linux machine, you could use “/opt/local/bin/fortune -s” to get only the short quotes, if you wish, or even “/opt/local/bin/fortune -o” for some… other quotes.

Promises Made…

Yes, yes… It’s all very cryptic and very melodramatic, indeed. I’m sure you’re all really impressed.

Though, spare a thought for those poor buggers reading this via the RSS feed to Facebook, and not on this blog. They’ll be even more in the dark…

But, to return the… <dramatic pause> promise.

Here’s the link to the Widgets I use to display my “Currently Reading” (as well as my “Previously Read” section) as well as the badges I display on the blog:

Do with them what you will…

Of WordPress, Plug-ins and Widgetey Things…

I’ve finally decided to re-hack my Template/Theme on JADB and get rid of two points of contention (AKA “I need to fix this at some stage”), the “Currently Reading” and “Snippets” “Badges” sections in the sidebar.

I suppose there’s no point in having dynamic sidebars if you don’t do something, erm…, dynamic with it, is there?

I have managed to now stop using “Custom Fields” in posts to populate the “Currently Reading” section (it had the advantage of time-stamping the posts with the primary book I was busy with, but it was also a bit of a schlep to keep up to date) instead just updating the widget directly…

I’ll put them up for download on WordPress’ Website as soon as my Plugin Access had been granted.

Easily Amused…

While it has been said, at least somewhat truthfully, that I am easily amused, I must admit to being rather amused that while my Blog renders quite fine on Classilla in my emulated — near pre-historic — MacOS 9 environment, Internet Explorer 8 on Windows 7 seems to have some issues… This makes me happy.