Jay McGavren's Journal

2008-09-30

$ fortune ruby

More often than I’d like, I have to open the Pickaxe to look up a core class or module that I can’t quite remember the methods on. I wanted to put some reminders in a place I could review them daily, yet was unobtrusive.

Enter the Phosphor screensaver for X-Windows; it scrolls text from a file or command by the screen. I pulled the classes and modules I wanted from the “ri” utility, made them into a “fortune cookie file” (run “man fortune” for details on fortune), and then piped fortune’s output through the screensaver.

I’ve attached the files I made. Unzip and drop them in /usr/share/games/fortune (or wherever fortune cookie files go on your system) and you’ll be able to type “fortune ruby” at a command prompt. Only core classes are included, but I’ll make a separate one for Rails on request. You can set up Phosphor (or other text-display screensavers like StarWars) from the xscreensaver control panel.

RubyFortuneCookies

Edit: On systems using gnome-screensaver, save this in your screensaver config folder, probably as /usr/share/applications/screensavers/xscreensaver-phosphor-ruby.desktop:

[Desktop Entry]
Encoding=UTF-8
Name=Phosphor - Ruby ri
Comment=(Shortened in 2021 so Google doesn't kill my page rank)
TryExec=phosphor
Exec=phosphor -root -scale 2 -ticks 5 -program 'fortune ruby'
StartupNotify=false
Type=Application
Categories=GNOME;Screensaver;

…then select “Phosphor - Ruby ri” in your Screensaver Preferences. This should also scale back the text so you can see the whole ri screen.

comments powered by Disqus