How To: Add a bunch of useless stuff to your desktop with GeekTool, Yahoo Widgets, and more!
I’ve recently gotten into playing around with GeekTool, an add-on System Preference Pane that allows you to add a wide range of both useful and useless things to your desktop, not only to make your life easier, but to make other geeks feel inferior. Sure, you can display the current date and time in the menu bar like a noob, but why not have a GIANT clock right in the middle of you desktop? Or show CPU usage, AirPort signal strength, Processor temps, RSS feeds, Facebook updates, computer uptime, iCal events, current weather conditions, etc.?
Above: Some cool examples of GeekTool custom desktops: 1, 2, 3, 4
Despite its geeky name, setting up GeekTool doesn’t require a whole lot of geeky knowledge. Luckily for us, the TRUE geeks of the world have already come up with the necessary code and scripts you’d want, so for the most part you will simply be copying and pasting bits of code that you find by Google-ing “GeekTool code” (or at least that’s what I did). I don’t claim to be any sort of GeekTool expert, but I’ll walk you through the basics of what I did to achieve MY results, and you can take the ball and run with it.
The GeekTool Interface
If you haven’t already done so, download and install GeekTool. What you’ll see when you open it (by going to your System Preferences>GeekTool) is the above screen. There are three basic types of GeekTool Geeklets you can use, but I created everything you see on my desktop using the SHELL type, so for the moment forget the others. In order to start a GeekLet, drag the word Shell onto your desktop. You should see an empty shell on your desktop, and the Properties box for it which should look like the the picture below.
Now, in order to make the magic happen, for the most part all you need to do is paste some code into the “command” field. You don’t really need to know WHY the code works, just accept that it does and you’ll be fine. So as an example, if you wanted to put the Current Day Of The Week on your desktop, you would simply paste
into the command box.
That is what gives me the giant “26” in the top left of my screen. By hitting the “Click here to set Font and Color” button you can… set the font and color.
So while there are definitely command strings that will print out the entire date (day, month, year, time) all in a line for you, I find the most fun comes from putting each element in its own Geeklet, which allows you to vary the size, color, opacity, and placement of each element. In fact, a quick look at the top right corner and you can see how many overlapping elements I have, each designed to give me a different bit of information.
As you can see the placement and design of your various Geeklets is completely up to you and allows you to easily match your desktop colors and style.
Here’s a quick list of the commands I used, one per Shell instance (I found these on various sites across the web, so I apologize for not giving credit to anyone in particular, however these are by far the most common commands out there):
Numerical day of the week (26):
Textual Day of the week (Thursday):
Numerical Time (03:18):
Current Uptime of your computer (time since last restart – at bottom of screen):
In general so far the commands we have entered are rather small and straightforward, however the one I have that displays my current iTunes artist and song title is quite large, but simply paste this into the command field (even though you won’t be able to see most of it without scrolling) and you’ll be good to go. (This only works when iTunes is open).
set h = ” 2″
if($(test $(ps -x | grep /Applications/iTunes.app/Contents/MacOS/iTunes | wc -l) -eq ” 2″))
if($(osascript -e ‘tell application “itunes”‘ -e ‘return player state is playing’ -e ‘end tell’))
echo “$(osascript -e ‘tell application “itunes”‘ -e ‘return artist of current track’ -e ‘end tell’)
$(osascript -e ‘tell application “itunes”‘ -e ‘return name of current track’ -e ‘end tell’)”
echo “Not Playing”
This one I again apologize for not being able to find where I got it, so if you know, please give me a link in the comments. The only problem I have with this one is I placed it directly above the iTunes icon in the Dock, so if I happen to open a new app, it slides the apps one space to the left, and ruins the placement until I quit it. I guess if I pin the Dock to the left side of the screen this wouldn’t be a problem though.
A couple of extra scripts
Now, not everything that GeekTool can accomplish can be done using a set command. For some functions, you need to actually call upon scripts (in my case, AppleScripts) to get the information they display. In these cases, you’ll just enter commands which tell GeekTool to look at the location of a specific script. For example, the script that displays the current temperature on my screen (the big 47F), I had to tell GeekTool to grab the info from a weather script I found by nicinabox (download here).
Now, don’t be scared of this, basically you just download the AppleScript to a folder of your choosing, and then enter the file path into a GeekTool Geeklet command path so it knows where to look. For example, to run that weather script (called “weather”), I enter:
(You would of course change the user from ME to YOU, and change the zip code from “37130” to whatever yours is). I certainly don’t pretend to know how the script does what it does, but what I do know is if you put “37130” at the end of it, it displays the temperature (based on your location). I also know, if you put “weather -cf 1 37130″ at the end instead, it gives you the day’s current weather condition, as well as the day’s predicted highs and lows (what you see under the 5-day picture forecast).
/Users/DocMacenstein/Documents/scripts/weather -cf 1 37130
And if you change that “1” to a “2”, you get a 2 line version with both today’s AND tomorrow’s forecast.
/Users/DocMacenstein/Documents/scripts/weather -cf 2 37130
At the moment my favorite Geeklet I have that is running an AppleScript is my “check for mail” script which I have cleverly incorporated with my desktop picture of Gwen Stefani. If you are a Gmail user, there are scripts for that as well, but this works with Apple’s Mail app.
To create this script, just open AppleScript Editor (located in Applications>Utilities” ) and paste in the following code:
set newline to ASCII character 10
tell application “System Events” to set iCalIsRunning to (name of processes) contains “Mail”
set finalText to “”
if iCalIsRunning then
tell application id “com.apple.mail”
set unreadCount to (get unread count of inbox)
if unreadCount > 0 then
set theMessages to (messages of inbox whose read status is false)
repeat with i from 1 to number of items in theMessages
set thisMessage to item i of theMessages
set fromMsg to (sender of thisMessage as string)
set subjMsg to (subject of thisMessage as string)
if subjMsg = “” then
— do something really important here
set subjMsg to newline & ” ” & subjMsg
set finalText to finalText & i & “. ” & fromMsg & subjMsg & newline
set finalText to “No new mail”
set finalText to “Mail not open”
Save the script as a script (not an app) into your Documents folder (I made a “scripts” folder inside of Documents). Next, just Drag a shell Geeklet to your desktop and enter this code in your commands:
Then, all that’s left to do is customize the font, size, color etc. I went for the “Evil Genius” comic font from Blambot since I wanted it to look like Gwen was talking (and since she is probably evil).
Oh, and if you want to know how I made that horizontal line on the desktop that connects the 5-Day weather forecast icons to the left side of the screen, I just made a shell and checked the “OVERIDE TEXT” box, and then typed _______ until I had it the length I needed. This is also a good way to add any static text you may want as well.
Something to keep in mind: Refresh Rates and CPU usage
On thing all Geeklets have in common is that the user can define the “refresh rate” for each, meaning how often they go out and update their status. Obviously setting everything to update every second might give you a slight performance hit, so depending on the geeklet, it is a good idea to set a reasonable refresh interval. For example, for a clock Geeklet, you likely might want to have it update every 60 seconds, for a weather Geeklet you might set it for every 600 or 1200 seconds. I have my check for new mail one at 15 seconds and my iTunes one set for every 10 seconds.
More customization than GeekTool can handle
I’ve only scratched the surface of what GeekTool can do – there are some really cool things with system monitoring and calendaring and such as well. But as nice as GeekTool is, there are some things GeekTool can’t quite do, or at least, can’t do if you have zero programming skill, like me. So for those things I have a couple other tricks I have stumbled across – the first of which being Yahoo Widgets.
Now, for some reason Yahoo Widgets don’t seem to download correctly for me in Safari, so use FireFox and go to http://widgets.yahoo.com/. Download the Yahoo Widget app, and from there you can download and run all sorts of widgets on your desktop, either as dragable “windowless” windows, or as immovable “on the desktop” objects. On my desktop above I have THREE Yahoo Widgets: Battery (The Battery indicator on the top left), Neon Gauges (the CPU graph on the bottom left, and Widescape Weather (the 5 day weather outlook (with icons) at the top left under the date. These are all accessed through a little auto-hiding sidebar, and each can be customized a bit with transparency, placement, color, etc.
Yet another thing
Above: To make the calendar line, I used the app Dateline.
I really never have anything going on in my life, and rarely need to even know the day of the week, but I felt my layout needed a horizontal element, so I decided on a thin, line-like calendar. I’m sure someone who knows what they’re doing could write a Geeklet that could do the job, but as I’ve said, I don’t know what I’m doing, so I found a shareware app called Dateline that does the trick. It’s free to use if you want a horizontal calendar, but you must pay for a vertical orientation and some other features. But for now, I’m cool with the free horizontal functionality.
Hiding the body
While there are times you need to resort to 3rd party apps to accomplish things like Dateline, the problem is, the app needs to be running in order to see it, which means it shows up in the Dock, which is lame, as we all know Dock space is at a premium. Luckily, there’s an app called Dock Dodger, which will keep any app you drag into its window from showing up in the Dock when it is launched. Well, ALMOST any app, I can’t seem to get Last.fm to do it, but whatever, it worked for Dateline.
Since I have no real hacking knowledge, I know I have only scratched the surface of what is possible in the world of desktop modification, but hopefully the results I have achieved will inspire other non-programmers to take a stab at customizing their desktops as well. And for all you super-brainy nerds who have cooler mods than me, tell me about them in the comments.