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
date +%d
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):
date +%d
Textual Day of the week (Thursday):
date +%A
Numerical Time (03:18):
date +”%I:%M”
AM/PM:
date +”%p”
Current Uptime of your computer (time since last restart – at bottom of screen):
uptime
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).
#!/bin/sh
set h = ” 2″
if($(test $(ps -x | grep /Applications/iTunes.app/Contents/MacOS/iTunes | wc -l) -eq ” 2″))
then
if($(osascript -e ‘tell application “itunes”‘ -e ‘return player state is playing’ -e ‘end tell’))
then
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’)”
else
echo “Not Playing”
fi
fi
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:
/Users/DocMacenstein/Documents/scripts/weather 37130
(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:
Check Mail:
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 hereelse
set subjMsg to newline & ” ” & subjMsg
end if
set finalText to finalText & i & “. ” & fromMsg & subjMsg & newline
end repeat
else
set finalText to “No new mail”
end if
end tell
else
set finalText to “Mail not open”
end if
finalText
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:
osascript /Users/DocMacenstein/Documents/scripts/checkmail.scpt
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.
Conclusion
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.
i get so many questions from friends about doing these kinds of mods and i usually just tell them to google it, or maybe about unsanity if they are clever enough. it’s nice to have options. i think i will even use it just to make my computer more unique 😀
I’m still missing a script that displays the current location, detected through Snow Leopard’s core location services.
Maybe even the weather display could be linked to this info, so I always would get the weather at my current location?
This is so awesome, it might be the nudge I’ve been waiting for to shell out the cash to upgrade to OSX 10.5. Thanks!
I looked at the weather script. It is actually a python script that gets the weather from yahoo.com based on you zipcode. When you run the command weather 37130, the 37130 is the zipcode you are passing. You can open the script in any text editor and look at it.
I don’t think this was clear / correct in your article.
P.S. There is a space between the she-bang ‘#!’ and the path ‘/usr/bin/python’, the script seems to work but this may cause problems at some point. (First Line)
In regards to your info on getting the weather displayed, the “37130” is a zip code. If you, or anyone else, wants their weather displayed, replace 37130 with the zip code of your current location.
Also in regards to the weather, “cf” should be “cm”. I couldn’t get it to work otherwise. Also, putting a 1 or 2 in there for me did nothing except make it break.
Dateline already has an option in its preferences to hide the Dock icon automatically
Hi,
this is nice, I like it! Where I can download walper with girl on 1st screen. Thanks
hi doc…thanks for the tricks, but could you please also tell how to display the current weather with celsius degrees? here in europe F send us nuts.. :=)
Hey Doc,
where can i find the nice wallpaper?
One of your best blog posts to date. I love this thing and have never heard of it before. Now going mad with it.
Don’t forget about the Image tool, which let’s you put any image, local or remote, on your desktop. Even PNG’s with alpha channels. I use it to grab current images from a local webcam and a satellite weather image from Weather Underground. Just pop the link into Geektool, give it a refresh of about 5 minutes.
Another really helpful use of Geektool is putting a “notes” file right on your desktop. I made a file called “notes.txt,” and pointed Geektool at it with the command:
cat ~/Documents/notes.txt
You would of course replace the path and filename with your own path and file. Then whenever I open up notes.txt in TextEdit, make changes, and save, it gets updated on my desktop. I’m sure there are any number of other apps that works as notepads, but I like this because it blends right into the background however I want it to.
I really liked the vertical calendar in one of the example screenshots, but there is 0 chance of me creating a textfile to display it every month, and there are any number of ways to output calendars using command line/shell scripting tools. So, if anyone is interested, what I decided upon was geektool shell windows with the following commands (all will output day/day of week (i.e., “29 Sun”, “30 Mon”, “01 Tue”, etc.”))
window 1 gives a vertical list 10 days back
for ((i=-10;i<=-1;i++)); do date -v “$i”d +”%d %a”; done
window 2 is just today
date +”%d %a”
window 3 gives tomorrow through the next 19 days
for ((i=1;i<=19;i++)); do date -v +”$i”d +”%d %a”; done
I did it as three separate windows for text formatting options (and because it was a quick way to deal with date + and date -) and hopefully it’s self explanatory to modify.
Enjoy.
hmmm…the itunes thingy just doesn’t want to work for me….i just pasted the text but nothing shows up…any clues?
I used to have all this sort of stuff all over my screen too. Six years ago. Then I realized they were pretty worthless. They cluttered the screen, they were either useless or duplicated something that was already in the menu bar, and sucked resources from my real work (some of this stuff really hammers the processor and memory).
I’ll admit a weather widget is useful for temperatures in April, May, and November, but it’s useless any other time. The rest of the year I know if I need a coat without having to check. If my system is running well, I don’t care if I’m using 25% or 88% of available resources; it’s working. Apple mail chimes and shows up in the dock (in fact it just went off as I type this!) If my disk is full enough to keep an eye on capacity all the time, I need a new drive not a graphic. I get the time, day, date, battery, and wi-fi in my menu bar. And I can see it when I have a window open on my screen.
Most Windows users got tired of this useless eye candy crap in 2004. Is it suddenly so popular on Macs because of all the people who’ve switched?
what about the battery images? what should i write it?
thx!!
Micah, python uses # as a comment, so there won’t be a problem.
What geeklet/script did you use to do the 5 day weather forecast icons? I’ve looked all over but can’t seem to find any that look like that. Yes, I’m copying your layout on my Mac. It looks perfect.
i have down loaded the weather channel on my computer and the date is wrong and there is no way to change it.how do you do this?
how do you put the correct address on the weather channel desk top?
Love Twitter? Don’t want to clog up your desktop? Twitter Ticker is definitely not useless stuff for your desktop – check it out! twitterticker.net
The nicinabox (download here) field isn’t working anymore… please help.
Who is that model on the Desktop again?
What wallpaper is that doc? This topic came along some years ago, and since then, I’m looking for it.
thanks
I don´t know how put the calendar ( the first image) in line, and the cpu usage graphic .
Could anybody help me?
Alguien podría ayudarme, no tengo ni idea de como poner el calendario ese en linea, y la gráfica de uso de la CPU,
Me podrían pasar el texto para el SHELl?
Gracias, thanks,
R.E. The wallpaper used. A quick search then narrowing by colour shows this: http://www.best-wallpapers.com/celebrities/g/gwen-stefani/wallpaper.php?id=51
The mail script keeps on giving me a headache. It keeps on prompting errors. First it complains about the first line, then about the quotation marks and then about the word something. I have absolute no clue what goes wrong
just an fyi .. yahoo widgets has been discontinued