macfidelity

|

rethinking the think-different thing

mac & apps | More Geektool Examples or how to display whatever you need on your desktop in Mac OS X

April 2nd, 2009 at 12:24

20090402_geektool_01

I am using Geektool on my Mac for many different tasks, so i thought about collecting some of those scripts here for my readers.

As always i’m open for comments, additional scripts and similar, so just use the comment function if you are missing some great snippet.

About Geektool

Just a few words regarding Geektool, as i expect most users know the application already based on experiences or older post in this blog.

What it is

GeekTool is a preference pane module that lets you display 3 different types of information on your desktop:

  • Log files
    Choose one or more log files (usually in /var/log directory) they will be shown in real time where you wish to see them.
    Common files are /var/log/system.log, /var/tmp/console.log, /var/log/httpd/*
  • Commands
    Specify unix (or shell) commands, and the output will be available anywhere, you will also have to type a refresh time.
    Common commands are uptime, df, netstat, vm_stat, ifconfig… You can pipe sed or awk scripts to filter outputs.
  • Pictures
    Grab any picture on the internet with its URL, and assign a frame type, transparency and so on…
    Common pictures are MRTG/RRD/Cacti graphs, webcams…

Additionaly, you can set “always on top” windows to keep a constant eye on certain information, as your clicks always goes through to not disturb your habits

How it looks like

20090402_geektool_02

Development

If you are wondering like me if Geektool is still developed, i got good news for you.
Balthamos is working on Geektool 3 – hosted at GitHub. So if you are into programming and want to share your almighty power, consider helping this project ;)

Geektool Snippets

I’ll try to post code & the output to give a better impression how it could look like

Displaying a calender on your Desktop

Code:

cal

or more advanced:

cal | sed “s/^/ /;s/$/ /;s/ $(date +%e) / $(date +%e | sed ’s/./#/g’) /”

Result:

20090402_geektool_03

or for even more fun (thx to Ice|House in irc)

Code:

cat /usr/share/calendar/cal* | grep `date +”%m/%d”` && cat /usr/share/calendar/de_DE.ISO8859-1/* | grep `date +”%m/%d”`

Result:

20090402_geektool_cal_nachtrag_01

Displaying free disk space on your Desktop

Code:

bdg=`df -h | grep “disk0s2″ | awk ‘{print $4}’`
echo “free on Mac : $bdg”

Result:

20090402_geektool_05

You need to replace the name of the disk (here: disk0s2) for sure, but that should be easily done after running the mount command in your terminal.

Displaying top processes on your Desktop

Code:

top -orsize -FR -l1 | grep % | grep -v Load | grep -v COMMAND | cut -c 7-19,64-69

Result:

20090402_geektool_06

Displaying uptime on your Desktop

Code:

uptime

Result:

20090402_geektool_04

Displaying random comic strips on your Desktop

That one is a bit more complex ( as it included getting images, selecting a random out of the collection etc), so i do have a single post for this task. Consider reading here.

Displaying text file on your Desktop

Code:

more /Path/to/your/file.txt

Result:

20090402_geektool_07

I do use that for my to-do-List.

Displaying system information on your Desktop

Code:

system_profiler SPHardwareDataType SPSoftwareDataType | perl -e ‘@info= <>; $info= join(“”, @info);if($info=~m@[\r\n]+\s*Computer Name:\s*([^\r\n]+)[\r\n]+@) {print “$1\n”;}if($info=~m@[\r\n]+\s*System Version:\s*([^\r\n]+)[\r\n]+@) {print “$1\n”;}if($info=~m@[\r\n]+\s*Memory:\s*([^\r\n]+)[\r\n]+@) {print “$1\n”;}if($info=~m@[\r\n]+\s*Total Number Of Cores:\s*([^\r\n]+)[\r\n]+@) {print “$1 x “;}if($info=~m@[\r\n]+\s*Processor Speed:\s*([^\r\n]+)[\r\n]+@) {print “$1 “;}if($info=~m@[\r\n]+\s*Processor Name:\s*([^\r\n]+)[\r\n]+@) {print “$1\n”;}’

Result:

20090402_geektool_08

Basically system_profiler is a perfect command for Geektool as it is almost almighty if it comes to system informations. So consider taking a look on the man page:

This hint is based on a hint on macosxhints.

More …

Tags: , , , ,

11 Responses to “mac & apps | More Geektool Examples or how to display whatever you need on your desktop in Mac OS X”

  1. Oliver Says:

    Muss man denn jetzt auf englische Artikel auch in englisch kommentieren?

    ReplyReply
  2. fidel Says:

    ne ;)

    ReplyReply
  3. konfluenzpunkt Says:

    Danke Fidel. Du hast den längsten…

    Ich möchte gern meinen “Net Monitor” ersetzen. Kann man irgendwie die aktuellen Send & Receive – Werte für bestimmte Interfaces anzeigen lassen?

    ReplyReply
  4. fidel Says:

    Schon mal so probiert ?
    http://www.macosxhints.com/article.php?story=20090326125916351

    Länge alleine zählt btw nicht ;)

    ReplyReply
  5. Andi Says:

    Hy,
    Echt Respekt für diese Tool-Sammlung inklusive der Intros, echt ich komm nicht mehr weg von diesen Artikeln :-)
    Mal ne Frage: bekomme im Terminal folgende Fehlermeldung beim “cal advanced” Befehl von oben:

    cal | sed “s/^/ /;s/$/ /;s/ $(date +%e) / $(date +%e | sed ’s/./#/g’) /”

    sed: 1: ““s/^/”: invalid command code ?
    -bash: s/$/: No such file or directory
    sed: 1: “’s/./#/g’”: invalid command code ?
    -bash: s/: No such file or directory

    Was mach ich falsch?
    Grüße
    Andi

    ReplyReply
  6. fidel Says:

    @andi:

    da hat wordpress mal wieder Teile geschluckt. Daher im folgenden mal die blöde aber funktionierende Screenshot Variante:
    http://fidel.vido.info/show/trash/20091011_geektool_cal_01.jpg

    Gruss
    fidel

    ReplyReply
  7. Andi Says:

    Danke funktioniert nun super :-)
    Lag wohl an den quotes beim copy paste !
    Perfekt!

    ReplyReply
  8. Simon Says:

    I’m so totally geeked out from reading this! I just had a brain explosion.

    ReplyReply
  9. fidel Says:

    @Simon
    you should find some more examples here:

    >> http://macfidelity.de/nerdtool-geektool-snippets-collection-for-mac-os-x/

    Best Regards
    fidel

    ReplyReply
  10. Visitor Says:

    Instead of replace the date of the day by # char, it is highlighted in green :

    cal | sed “s/^/ /;s/$/ /;s/ $(date +%e) / $(echo ‘\x1b[1;32m’)$(date +%e)$(echo ‘\x1b[0;37m’) /”

    Follow the link to find more details on color and font changes :

    link : http://wiki.archlinux.org/index.php/Color_Bash_Prompt

    ReplyReply
  11. Guide: GeekTool – info på skrivebordet « FjeldWeb Says:

    [...] Examples or how to display whatever you need on your desktop in Mac OS X [...]

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>