Yesterday I wrote up a simple review of GeekTool. Today I’m going to show you how to take advantage of its power and build a clean, custom, functional GeekTool setup. Usually when you hear anything about GeekTool you see a desktop that looks similar to one of these. While these setups might be useful in some situations, they aren’t what I would consider pretty. Prepare to get your hands dirty, we’re playing with code! (ok, ok… it won’t be hard, I just had to psych you out!)
Here’s a preview of what the following GeekTool scripts/commands will look like if you implement them all. Displayed in the screenshot is iTunes album art, iTunes track info, monthly calendar, internal ip addresses, external ip addresses, the wireless network you are connected to, time since you’ve restarted your computer, and cpu/memory statistics. You can easily pick and choose what info you’d like to display with GeekTool. Keep reading and I promise that you’ll want to use at least one of these GeekTool entires!
Before I start I’d like to thank everyone who’s code I’ve used. I’ve given you full credit by citing each script/command, if you are the author of a script and I mis-cited the source, let me know.
Monitor CPU/Memory Usage With Top

Using the top command you can list processes that are currently using the CPU. You’ll need to use a few switches to get top to work with GeekTool, namely -l2. By modifying the cut at the end of the command you can choose which columns of information you’d like displayed. You can read more about how to edit those columns at the source link below. By inputting the following command into GeekTool as a shell entry you’ll see exactly what I have in the screenshot above.
GeekTool Shell Entry
top -ocpu -FR -l2 -n20 | grep '^....[1234567890] ' | grep -v ' 0.0% ..:' | cut -c 1-24,33-42,64-77
Source: VRic’s comment on MacOSXHints.com
Display You Computer’s Uptime And Total CPU/Memory Usage

Unlike the PC world, you’re Mac may not be restarted for days or even weeks. Thats why I like the next command. It not only tells me how long its been since I restarted my MacBook Pro, but it also summarize my CPU/Memory usage. At a quick glance I can tell how much work my computer is doing. I edited the original command that I found to display the info on multiple lines so I could tuck it nicely along the left side of my screen.
GeekTool Shell Entry
uptime | awk '{print "UPTIME : " $3 " " $4 " " $5 " " }'; top -l 1 | awk '/PhysMem/ {print "RAM : " $8 " "}' ; top -l 2 | awk '/CPU usage/ && NR > 5 {print $6, $7=":", $8, $9="user ", $10, $11="sys ", $12, $13}'
Source: MacGeekery.com
Current Wireless Network
![]()
I found this neat script which displays the wireless network that your Airport is currently connected to and the channel it’s on. The one caveat of this script is that it only displays the first word of the access points name. Maybe someone can find a fix for this :) Make a new file, name it airpot.sh and copy the airport.sh code into that file. You’ll need to make sure that this file is set to be executable. At the terminal type: chmod 755 airport.sh . Then use the following command in GeekTool as a Shell Entry. Make sure you change the path in the shell entry to the location of your airport.sh file.
GeekTool Shell Entry
sh /Users/neyoung/bin/airport.sh
CODE - airport.sh
#!/bin/sh
myvar1=`system_profiler SPAirPortDataType | grep -e "Current Wireless Network:" | awk '{print $4}'`
myvar2=`system_profiler SPAirPortDataType | grep -e "Wireless Channel:" | awk '{print $3}'`
echo "Airport : $myvar1 - $myvar2"
Source: Yann Bizeul’s thread at Tynsoe.org
Ethernet And Airport IP Addresses
![]()
I don’t know about you, but I really like to be able to find out my IP address at a quick glance. The following script will show the IP addresses of your ethernet and airport interfaces. I edited this script so that the output will say INACTIVE if you aren’t using one of the two. You’ll need to create a new file named ipaddresses.bash and copy the contents of the script below into the file. Make sure that you set the script to be executable with chmod. Then make a shell entry in GeekTool to call the ipaddresses.bash script.
GeekTool Shell Entry
bash /Users/neyoung/bin/ipaddresses.bash
CODE - ipaddresses.bash
#! /bin/bash
myen0=`ifconfig en0 | grep "inet " | grep -v 127.0.0.1 | awk '{print $2}'`
if [ "$myen0" != "" ]
then
echo "Ethernet : $myen0"
else
echo "Ethernet : INACTIVE"
fi
myen1=`ifconfig en1 | grep "inet " | grep -v 127.0.0.1 | awk '{print $2}'`
if [ "myen1" != "" ]
then
echo "AirPort : $myen1"
else
echo "Airport : INACTIVE"
fi
Source: Yann Bizeul’s thread at Tynsoe.org
External IP Address
![]()
Having the IP address of your ethernet/airport card might not always be enough. If you are behind a router or dsl/cable modem then you’ll also have an external IP address. If you’d like to easily find out what that address is use the following command as a GeekTool shell entry.
GeekTool Shell Entry
echo "External :" `curl --silent http://checkip.dyndns.org | awk '{print $6}' | cut -f 1 -d "<"`
Source: MacOSXHints.com
Calendar Of The Current Month

I’m lazy, and if I can avoid opening the Dashboard or iCal I will :) Using the next command you can have a nice little monthly calendar placed right on your desktop. The current day will be denoted with double pound signs (ie. ##).
GeekTool Shell Entry
cal | sed "s/^/ /;s/$/ /;s/ $(date +%e) / $(date +%e | sed 's/./#/g') /"
Source: TeutonicSpectator.com
Currently Playing Track In iTunes - Track, Artist, Album
![]()
I use YouControl: Tunes to show me the track info and album art when a new song starts playing in iTunes. But YouControl: Tunes notifies me via an overlay and it won’t stay up there forever. So using the iTunesInfo.scpt applescript I can always look and see whats currently playing. Make a new file named iTunesInfo.scpt and put put all the iTunesInfo.scpt code into it. Then use the following shell entry to run with script in GeekTool.
GeekTool Shell Entry
osascript /Users/neyoung/Pictures/iTunes Artwork/iTunesInfo.scpt
CODE - iTunesInfo.scpt
tell application "System Events"
set powerCheck to ((application processes whose (name is equal to "iTunes")) count)
if powerCheck = 0 then
return ""
end if
end tell
tell application "iTunes"
try
set playerstate to (get player state)
end try
if playerstate = paused then
set trackPaused to " (paused)"
else
set trackPaused to ""
end if
if playerstate = stopped then
return "Stopped"
end if
set trackID to the current track
set trackName to the name of trackID
set artistName to the artist of trackID
set albumName to the album of trackID
set totalData to "Track : " & trackName & trackPaused & "
Artist : " & artistName & "
Album : " & albumName
return totalData
end tell
Source: TeutonicSpectator.com
Currently Playing Track In iTunes - Album Art

To display the current tracks album art you’ll need two GeekTool entires. The explanation to this can be found in the source link below. Basically the first script creates the album art image. The second entry displays the image. If the current track doesn’t have any album art or if iTunes isn’t running then nothing is displayed. You’ll notice that the album art or the track info from the previous script won’t change immediately when a new song starts to play. This is a downfall of GeekTool.
GeekTool Shell Entry
osascript /Users/neyoung/Pictures/iTunes Artwork/iTunesArtwork.scpt
GeekTool Picture Entry
file:///Users/neyoung/Pictures/iTunes%20Artwork/albumArt.tif
CODE - iTunesArtwork.scpt
(* Set Defaults and Loctions *)
set iTunesArtworkFolder to ((path to home folder) as text) & "Pictures:iTunes Artwork:"
-- Artwork Folder
set DefaultArtwork to ((path to home folder) as text) & "Pictures:iTunes Artwork:Default:albumArt.tif"
-- When there's no artwork or iTunes isn't running. This is a transparent TIFF.
set DefaultFolder to ((path to home folder) as text) & "Pictures:iTunes Artwork:Default:"
-- Default Folder
set FromiTunesFolder to ((path to home folder) as text) & "Pictures:iTunes Artwork:From iTunes:"
-- Where iTunes saves the Artwork
set ArtworkFromiTunes to FromiTunesFolder & "albumArt.pict" as file specification
-- The Artwork from iTunes
set AlbumArtwork to (path to home folder) & "Pictures:iTunes Artwork:albumArt.tif" as string
-- The Album Artwork
set UnixAlbumArtwork to the quoted form of POSIX path of AlbumArtwork
-- Unix path to the Album Artwork
(* Check if iTunes is running. *)
tell application "System Events"
if exists process "iTunes" then
try
(* Get Artwork From iTunes *)
tell application "iTunes"
set aLibrary to name of current playlist -- Name of Current Playlist
set aTrack to current track
set aTrackArtwork to null
(* Is there any Artwork? *)
if (count of artwork of aTrack) ≥ 1 then
set aTrackArtwork to data of artwork 1 of aTrack
set fileRef to (open for access ArtworkFromiTunes with write permission)
try
set eof fileRef to 512
write aTrackArtwork to fileRef starting at 513
close access fileRef
on error errorMsg
try
close access fileRef
end try
error errorMsg
end try
(* Convert to Tiff *)
tell application "Finder" to set creator type of ArtworkFromiTunes to "????"
tell application "Image Events"
set theImage to open ArtworkFromiTunes
save theImage as TIFF in iTunesArtworkFolder & "albumArt.tif" with replacing
end tell
else
(* If there's no Artwork use the Blank Arwork. *)
tell application "iTunes"
if (count of artwork of aTrack) < 1 then
set aTrackArtwork to DefaultArtwork
set unixDefaultFolder to the quoted form of POSIX path of DefaultFolder
set unixiTunesArtworkFolder to the quoted form of POSIX path of iTunesArtworkFolder
do shell script "ditto -rsrc " & unixDefaultFolder & space & unixiTunesArtworkFolder
end if
end tell
end if
end tell
end try
else
if (exists process "iTunes") is false then
(* If itunes isn't running use the Blank Artwork *)
tell application "Finder"
set unixDefaultFolder to the quoted form of POSIX path of DefaultFolder
set unixiTunesArtworkFolder to the quoted form of POSIX path of iTunesArtworkFolder
do shell script "ditto -rsrc " & unixDefaultFolder & space & unixiTunesArtworkFolder
end tell
end if
end if
end tell
Source: MacOSXHints.com
Final Notes
While working with GeekTool for the last few days here are some observations that I’ve made. GeekTool uses polling to check for updates to files/pictures/scripts. This has some drawbacks, one of which is high CPU usage if you set the refresh time to low for your entries. Normally 10 seconds works well. Another downfall of polling is that any output changes that a script generates won’t be updated till the GeekTool refreshes. By using events, GeekTool could use less CPU cycles and make updates to its display more timely. However, I don’t know if using events is even be possible with simple shell scripts.
I found one bug. Every once in a while my GeekTool entries overwrite each other. I think it’s just a display bug, because it was never permanent. If you close the GeekTool window and reopen it everything will be fine. I can’t figure out exactly how this happens, but it does time to time.
The GeekTool entries that I’ve illustrated in this article are by no means the only things that GeekTool can display. Remember, by using scripts and shell commands you can display just about anything! A few other things that people like to dispaly are hard disk statistics, a floating picture of your wife/kids/pet, or even a todo list.
The one thing that I’d really like to add to my GeekTool display setup would be current and average network traffic. I like to know when my internet connection is churning away so that if I’m not using it I investigate. A neat little graph would be cool :) But I’ve yet to run across anything to accomplish this.
I hope you’ve learned something by this article and that you’ll use some of the scripts/commands I’ve listed. I’ll make sure to make future post about other interesting things that I use GeekTool to display.
Share This Article With Your Friends!






Where did you get your desktop background from?
An artist named el1as had it posted in his DeviantArt Gallery.
Here’s a link to the image, it’s called In the Dark
You can use “MenuMeters” to display, amongst others, your network activity.
Wow! Great review, I’m downloading it now :D
Thanks for the great review. I am going to download GeekTool and follow your guide as soon as I get home.
www.tastybooze.com
I actually ran into MenuMeters last night Vidal. I was reading an article at TUAW and they author was talking about all the icons in his menu bar. One of which was MenuMeters. One thing lead to another and I ended up at this site, which lists a bunch of menu bar applications :) Thanks for the suggestion!
If anyone needs any help setting up GeekTool feel free to ask and I’ll provide any insight that I can.
I personally didn’t like MenuMeters, I had it a whlie back, and I ditched it after two days. I’d rather have that info displayed with GeekTool.
I looked around for a bit and couldn’t find an easy fix to make MenuMeters background transparent. But I did find this neat trick to make the CPU load graph look like fire :)
Wow that’s wicked!
One stupid question, when you say make a file on your posts, such as “create a new file named ipaddresses.bash” or “Make a new file, name it airpot.sh and copy the airport.sh” are these files made on the Script Editor? Or is it on some other application?
Thanks
Paul - if you’re doing this in terminal type ‘touch ipaddress.bash’ - that will create an empty file with the appropriate filename that you can then insert the text as advised and change permissions if necessary.
Ohhh ok thanks Dave. Never was good with Terminal, didn’t understand it’s purpose, but hey, that’s a use for it! thanks.
Personally I find terminal quite comforting - theres a lot of things I can accomplish faster there than pointing and clicking :)
You know what? You’re probably right, I probably just feel the way I do cause I’m really ignorant when it comes to using terminal. Need to start learning how to use it…
If you have any experience with Linux you’ll find yourself really comfortable with the terminal. You can accomplish a lot of things with it very quickly if you know the right commands and the proper switches.
For example, when I copied a bunch of pictures onto my MacBook Pro all the permissions were messed up. With a short shell command I was able fix all permissions on 10gb worth of pictures in the matter of a few seconds. Thats just one example, the terminal is VERY powerful.
Very cool. I was inspired to do the same, but changed the iTunes script to also work with streaming radio:
set trackID to the current track
set trackName to the name of trackID
set theStream to the current stream title as text
if theStream is not “missing value” then
set totalData to “Stream : ” & trackName & trackPaused & ”
Title : ” & theStream
else
set artistName to the artist of trackID
set albumName to the album of trackID
set totalData to “Track : ” & trackName & trackPaused & ”
Artist : ” & artistName & ”
Album : ” & albumName
end if
return totalData
If you want to display drive info (mount points, space and so on) use
df -H -l
(not mine, found on one of the coutless Geektool hint pages out there :) )
I like that Dave, I’m going to add that to my display :)
Yeah, that one’s a permanent fixture on mine too - I particularly like how it includes mouted CDs and DMGs and stuff
On the iTunes Artwork you mention two entries. Is there any need for the first entry to be in GeekTool? I didn’t read the entire script but I assume it copies the artwork image to a place the second GeekTool entry can find it - right?
So - could a cron job take care of the first part and then you’d just add the second entry to GeekTool? I don’t know if that would save any processing power - probably not - but I was just curious about it.
Yes, the first script is only needed to create the album art image file. You could theoretically set it up as a chron job. The original author probably just used GeekTool instead of a chron job since he was already using GeekTool to display the iTunes artwork. You should try it both ways and see if using a chron job is better :)
Anyone have an idea of how to get rid of that last comma when using the uptime command?
Ford, here’s what you are looking for. If we pipe the uptime command into sed we can remove the last character of a line with some trickery… sed -e ’s/.$//g’ Here’s the full command to use :)
Wow, I have no idea how that sed command works, but it works like a charm…
I changed my uptime command to be a bit different, here’s what I’m using now:
echo UPTIME: `uptime | cut -c 11-24` | sed -e 's/.$//g'When you use awk, the output sometimes looks like:
UPTIME: 2 days, 3when it should have said:
UPTIME 2 days, 3 minsUsing the cut command seems to accomodate for that but I still need to watch it to see how it looks when the time is way different.
Also, for the top command, wouldn’t it be easier to use tail instead of grep to find the last 20 lines?
Here’s what I use:
top -ocpu -FR -l2 -n20 |tail -n21 | grep -v ' 0.0% ..:' | cut -c 1-24,33-42,64-77Thanks for the help!
Ford, I tried your uptime change and I think that like the awk solution it works in certain situations. Here’s my output
UPTIME : 4 days, 15:46
Notice that min isn’t appended to the line. I’ll take a look at it a bit later and see if I can come up with a fix.
I think that your use of tail with the top script is optimal. I don’t think that tail does any heavy parsing like grep, which your cpu will appreciate :) Thanks for the heads up!
That’s actually how I wanted the output to look. Notice that when you have a time like 15:46, the full output of uptime won’t say mins or hrs, those only show up when it’s been less than 1 hour that day or the minutes are at zero.
The only thing I have yet to find out about is how it ends up looking when I get into double digits with the days, etc.
Thanks for your help!
Hey Nick,
Thanks for taking the time to post. I’m a bit of a beginner, and just downloaded Geek Tool today. I had no problem setting up the date, calendar, and Hardrive tracker, but I’m a bit confused how to set up the iTunes tracker. Obviously the shell command shouldn’t be an issue, but I can’t figure out how to make the iTunesInfo.scpt file and insert the command info. Can you help me out?
Hi,
very nice tips you’ve given on how to use GeekTool!
Here’s a way I’ve found to display Battery stats:
/usr/sbin/ioreg -p IODeviceTree -n battery -w 0 | grep IOBatteryInfo
does anyone of you know a way to display temperature and fan stats, these would be the last missing commands to make this Geektool a full replacement of istat to me!
Adrixan,
That’s an awesome way to show the battery info, much better than the way I just discovered:
system_profiler SPPowerDataType | grep mAhI’m still searching for a way to show cpu temperature… it’s gotta be in there somewhere!
Hi,
I’ve been doing some research on that today, but it doesn’t seem to be very easy to extract these infos, I’ve taken a look into the iStat Pro package, but it doesn’t just use a simple command to get the informations, it seems. Maybe someone else might find a way!
Adam,
Here’s how you setup the iTunesInfo.scpt file. Open
/Applications/AppleScript/Script Editor.app
Now copy and paste the following code into the Script Editor
Now click File > Save As…, put iTunesInfo.scpt as the name and change the file format to Application. Now click Save.
Now that iTunesInfo.scpt is created open up GeekTool and make a new shell entry. Type the following into the shell entry field.
Make sure you change /Users/neyoung/code/ to the directory that you saved the iTunesInfo.scpt application to.
Hope that helped :)
Ford & Adrixan,
Wow I never thought to try to put the battery info of my MBP in my GeekTool setup. I could get the command that Ford posted to work, but not the one that Adrixan posted. Are you using an Intel Mac Adrixan?
Nick Young,
no, sorry, I’m stil lusing a 12″ Powerbook, so it might be different for MBP’s maybe there is a similar way to make it give the same output as well. The one I was using was just a snipplet I found while searching for a way to display the information.
Thats probably why I can’t get the info to display :(
There must be an Intel Mac equivalent to the command that you found. I’ll have a look around and see if I can come up with anything.
Nick,
I guess that is the problem, I’ve also not been able to find a way to monitor the temperature except for downloading another tool that just does this job and allows you to run it via command line. But for me that’s uninteresting, as I want to use OS X’s built in features only, or maybe a little script.
Adrixan,
I ran across a script on MacGeekery that says that allows you to output sensor data to the command line. But, it uses ioreg, just like your battery script so it doesn’t work that well on my Intel Mac. You might have some success with it. I found some apps (Temperature Monitor and another one also named Temperature Monitor)that let you output the temps to the command line as well, but I’d like a pure OS X solution :)
Nick,
Thanks for getting back to me regarding my post about getting the iTunes script running. I just tried to enter the command into Script Editor, and when I try to save I receive a Syntax Error that says: Expected end of line, etc. but found unknown token. I’m not sure what I did wrong. Any ideas?
Adam, I forgot to escape the &’s, my bad :(
Use the find feature of Script Editor.app (ie Apple F). Then search for & and replace it with &. That should fix your Syntax Error. Good Luck!
Nick,
I think I made the changes correctly in Script Editor using the find feature. Remember, I’ve never used this application before. In the find menu, I REPLACED ALL the &’s with &.’s. After, I tried to save it again, and I got a different Syntax Error. This one said the following: “Syntax Error…Expected expression but found unknown token.” Again, I think I performed the task correctly, but I’m not sure. When you get a chance, let me know your thoughts. I really appreciate it.
Adam
Nick,
Just figured it out. Was able to save the script, but its still not working. I think it has to do with the way I’m typing in the Shell command in geektool. How do I find out the directory that I saved the iTunesInfo.scpt application to?
Nick,
thank you very much for the script, it works great on my Powerbook, now I’ve got all the information I’ve missed after uninstalling iStatPro right on my Desktop!
Adam,
and replace it with &. that should do the trick. If you want I can just email the script to you and it should avoid all this headache.
Sorry, my fault again. I didn’t review my comment after I posted it. You want to search for
Adrixan,
Congrats on the GeekTool nirvana!
I cleaned up the IP Address script a bit, addeded the external address as well.
#! /bin/bash
echo “External :” `curl –silent http://checkip.dyndns.org/ | awk ‘{print $6}’ | cut -f 1 -d “
Looks like it got cut off at the bracket
"<"
#! /bin/bash
echo “External :” `curl –silent http://checkip.dyndns.org/ | awk ‘{print $6}’ | cut -f 1 -d "<"`
myen0=`ifconfig en0 | grep “inet ” | grep -v 127.0.0.1 | awk ‘{print $2}’| grep -v inet`
if [ “$myen0″ != “” ]
then
echo “Ethernet : $myen0″
else
echo “Ethernet : INACTIVE”
fi
myen1=`ifconfig en1 | grep “inet ” | grep -v 127.0.0.1 | awk ‘{print $2}’| grep -v inet`
if [ “myen1″ != “” ]
then
echo “AirPort : $myen1″
else
echo “Airport : INACTIVE”
fi
Nice app. Too bad it can’t handle shell colors:
Black=”\[33[0;30m\]”
DarkGray=”\[33[1;30m\]”
LightGray=”\[33[0;37m\]”
White=”\[33[1;37m\]”
Blue=”\[33[0;34m\]”
LightBlue=”\[33[1;34m\]”
Green=”\[33[0;32m\]”
LightGreen=”\[33[1;32m\]”
Cyan=”\[33[0;36m\]”
LightCyan=”\[33[1;36m\]”
Red=”\[33[0;31m\]”
LightRed=”\[33[1;31m\]”
Purple=”\[33[0;35m\]”
LightPurple=”\[33[1;35m\]”
Brown=”\[33[0;33m\]”
Yellow=”\[33[1;33m\]”
`tail -f /var/log/secure.log|colorize` doesn’t work :(
Hello and thanks for this tutorial. I tried the iTunes Twicks.
The one that dispalys current track info worls fine, but I have a problem with the one that displays Artwork.
I created ~/Pictures/iTunes Artwork folder and all needed stuff, including the script.
The problem is that I have to run the script manually in order for the right ArtWork to display… di I miss something ?
Francois
I found this program called CoconutBattery that displays the batteries “Design Capacity”, “Max Capacity”, and “Current Capacity”
ioreg -w0 -l | grep DesignCapacityioreg -w0 -l | grep MaxCapacityioreg -w0 -l | grep CurrentCapacityThe output line isn’t pretty so I hide a portion of it off the screen. If anyone knows the terminal, what would someone add to change how the output wold look like.
Francois,
You need to make TWO GeekTool entries. The first is a picture entry and the second is a shell entry. It sounds like you have the picture entry working. Now you just need to make a shell entry to create the album art image so that you don’t have to do it manually. Here is the code that you need to enter as a new shell entry
osascript /Users/neyoung/Pictures/iTunes Artwork/iTunesArtwork.scpt
I hope that this works for you :)
Steven,
Ask and you shall receive!
Nick,
Thanks for your help. Let me give you details about what I did…
I did 3 things :
1)Create the script (by copying the source you give) and save it in ~/Pictures/iTunes Artwork/iTunesArtwork
2) inGeek Tools, I created an entry including this shell command : osascript /Users/MyAccount Name/Pictures/iTunes Artwork/iTunesArtwork.scpt
3) in GeekTool, I created another entry including this picture commande : file:///Users/MyAccount Name/Pictures/iTunes Artwork/albumArt.tif
Each GeekTool command have a 10 sec. refresh time.
When I do nothing… nothing happens ;-)
When I run the script manually (using Script Editor)… the playing album artwork displays correctly, but never changes unless I run the script manually.
I do not see where the bug can be… :-/
Francois
Francois,
I can only think of one thing that could be your problem. You said that you named the script iTunesArtwork in step one. But in step two when you call the script you are referencing iTunesArtwork.scpt. The two need to match. Either make them both iTunesArtwork or make them both iTunesArtwork.scpt . Hopefully that will fix your problem :)
As usual, trivial bugs never appear first ! I added the right extension and all works fine.
Thanks !
Francois
Okay I think geek tool is def hogging my cpu on the macbook.
If you have any info on beginners shell and script usage I would appreciate it.
BTW your desktop looks pretty awesome.
Your Ethernet And Airport IP Addresses Geek Tool script is exactly what I’m looking for, but I just can’t get it to work. I’m very inexperienced with Terminal don’t know what I’m doing wrong. Perhaps you could send me a detailed step-by-step? I don’t even know if I created the ipaddresses.bash file correctly.
The Uptime and Memory/CPU usage tips are fantastic, too.
Yea! I’m having the same problem! After trying different things with it, I managed to get ‘Airport’ but it didn’t display ethernet nor any ip addresses, it would be good if u could send a step by step for it to my email, or on the comment board.
Also the display info iTunes shell is kinda funky– When I do the script on the script editor, and save it as a ‘.scpt’ but as an application format, it tells me I have to change it to .app, or make it .scpt.app, I’m definitely sure I’m doing something weird on that.
Anyways, when you’re not busy, it would be nice to have some light shed into my direction :D
This is my very first post to any online blog. I am new to mac and scripting. I am really impressed with the Geektool considering the possibilities it has. I used the network script but was not happy with the lengthy output so went through the script understanding wat was happening, then thought of creating my first script with trial and error method. This is my script:
====================================================================
myen0=`ifconfig en0 | grep “inet ” | grep -v 127.0.0.1 | awk ‘{print $2}’`
myen1=`ifconfig en1 | grep “inet ” | grep -v 127.0.0.1 | awk ‘{print $2}’`
myvar1=`system_profiler SPAirPortDataType | grep -e “Current Wireless Network:” | awk ‘{print $4}’`
myvar2=`system_profiler SPAirPortDataType | grep -e “Wireless Channel:” | awk ‘{print $3}’`
myvar3=`system_profiler SPNetworkDataType | grep -e “Router: ” | awk ‘{print $2}’`
ext1=`curl -s http://checkip.dyndns.org/ | sed ’s/[a-zA-Z/ :]//g’`
if [ “$myen0″ != “” ]
then
if [ “$myen1″ != “” ]
then
echo “Connection : Ethernet|Airport [$myvar1 : $myvar2]”
echo “IP Address : $myen0|$myen1″
else
echo “Connection : Ethernet”
echo “IP Address : $myen0″
fi
else
if [ “$myen1″ != “” ]
then
echo “Connection : Airport [$myvar1 : $myvar2]”
echo “IP Address : $myen1″
else
echo “Connection : No Network”
echo “IP Address : No Network”
fi
fi
echo “Router : $myvar3″
echo “External : $ext1″
====================================================================
I would really like to know your views about the script and also need your help as i am not able to achieve the expected output considering when both the interfaces (Ethernet & Airport) are connected. Also how toscript for the scenario where both the interfaces are connected to different networks - 2 Local IPs, 2 Routers and 2 WAN IPs.
Next I would like to find out the ISP name using the WAN IP.
Sorry for the long post, i am really excited using the Geektool.
Thanks
I’m having a problem with the album art as Francois was above. I made sure everything matches and it’s all typed in correctly, but for the life of me i cannot get the script to automatically update. What am I missing?
Hey, glad to see others using geektool. Isn’t it great?
I recently migrated my main PC to Linux and have been trying to set up a geektool-esque look on my computer, but I am having trouble:(
Regardless, here is what my geektool-ed mac (laptop) looks like. Image is compressed a bit, but you can get the general idea: http://img137.imageshack.us/img137/3…screen1bq9.gif
Err, whoops. That’d be… http://img137.imageshack.us/img137/3045/fullscreen1bq9.gif
its the greatest thing i have ever seen
Great article! One problem though, I copied/pasted the script for the Uptime, CPU Usage Shell, but all it shows me is Uptime and RAM. CPU does not appear on the third line. Help :(
Also can you explain to me what the number after the comma on the first line means? (eg, UPTIME: 12 mins, 1) What does that 1 stand for? Days?
Hey, i keep copying and pasting the itunesInfo.scpt into “Script Editor” and it gives me an error
expected end of line, etc. but found “)”.
This is probably a real easy fix, but i must confess. im at a loss. Any ideas? Thanks alot. :)
Hey, this thing is great, thanks for all the tips. I have one question, is there anyway to add the track time into the shell? It’d be really helpful to know how long the song is or how far I am and such.
Hey,
Great entry and follow up. Got a tip and a question…
Tip: you can get updating weather images from BBC weather by cutting the image address from the 5 day forecast and adding as a picture on GeekTool.
Question: anyone got a nice way to display RSS/Atom feeds with this?
Ed
Dunnit:
curl –silent “http://www.guardian.co.uk/rss” | grep -E ‘(title>|description>)’ | \
sed -n ‘4,$p’ | \
sed -e ’s///’ -e ’s///’ -e ’s///’ -e ’s///’ | \
head -n 10
Save as “rss-feed.sh” and run from GeekTool.
:-)
Oops, my sed commands got messed up there because they had tags in …
curl –silent “http://www.guardian.co.uk/rss” | grep -E ‘(title>|description>)’ | \
sed -n ‘4,$p’ | \
sed -e ’s/<title>/ - /’ -e ’s/<\/title>//’ -e ’s/<description>//’ -e ’s/<\/description>//’ | \
head -n 14
Hope that works …
I’m using Geektool and loving it - however, my system.log has moved over and geektool isn’t updating to the new log, even when I force refresh. The final lines says ‘logfile turned over’ and the new system.log isn’t displaying. I have enter the system prefs, delete the existing file path reference, force refresh, then add in the system.log file path.
Surely there’s an easier way which I just don’t know how to do?
Hi everyone,
Just came across this page and found it really useful. But, like lots of other folks here, I had some issues getting some of the scripts to work. One of the problems may be the following:
If you’re trying to run a script in a folder name with a space in it, you need to add the backslash. So for me, my home director is ‘mdrew’ and if I’m trying to run a script in:
/Users/mdrew/Pictures/iTunes Artwork/ScriptName.scpt
I need to enter the shell command as:
osascript /Users/mdrew/Pictures/iTunes\ Artwork/ScriptName.scpt
This is a common issue with Linux/Unix-based systems. It may be obvious to most but I bet not to all. Hope that helped.
Oh, one question. The iTunesInfo script works well when I’m playing regular stuff from my library, but if I’m listening to a streamed station via iTunes I just get an incorrect track listing and nothing for Artist or Album. (Although they appear on iTunes correctly.) Any thoughts?
-
-
Does top keep running like it would in terminal without any options, updating continuously? Or is it grabbing the information at the interval set in Geektool and quitting until the next interval?
Also - I’m not getting the CPU info you have in your Uptime entry. Any idea why that might be?
Here’s an improvement to the network connectivity script posted above..
The output looks something more like this:
I use the parsed output of the command-line airport status tool. It’s a handy doodad, and located at: /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport
Here’s my perl script..
Alex, your perl script output looks like this on my computer.
ETHERNET IP : INACTIVE
AIRPORT STATUS: CONNECTED
SSID : Lothlorien
RATE : 172.16.1.8 Mb/s
AIRPORT IP : 172.16.1.8
Hi, your external ip address script has < in it instead of an angular bracket. Here’s the correct version (I hope it does not get messed up by your blog engine.
echo “External :” `curl –silent http://checkip.dyndns.org | awk ‘{print $6}’ | cut -f 1 -d “
Newbie question: for Alex’s new network connectivity command is it simple enough to cut and paste his script into a text file called network.sh or do I need to do something else to it?
When I run it as a shell command it gives me an error “: No such file or directory.
I’m not sure what else needs to be done. Thanks