GeekTool

GeekTool is a solid attempt to remedy that situation by bringing an alternate way to handle many Mac system settings. The app installs quickly and opens to a simple interface allowing you to create. GeekTool is a software for Mac OS X that lets you display on your desktop all kinds of informations using log files, shell scripts or images.

42 Astoundingly Useful Scripts and Automations for the Macintosh

  • GeekTool is a great way to display the results of little scripts on your desktop. Using ANSI color codes can make those scripts even more useful. You can also change the status of the status button from “success” to “failure” depending on your script’s exit code. Command-line mail on OS X: re-alpine and Geektool.
  • GeekTool has come a ways since then, and setting up a gorgeous HUD using GeekTool is easier—and GeekTool itself is more powerful—than ever. Geek to Live: Monitor your Mac and more with.

2019 August 23/6:00 AM

Work faster and more reliably. Add actions to the services menu and the menu bar, create drag-and-drop apps to make your Macintosh play music, roll dice, and talk. Create ASCII art from photos. There’s a script for that in 42 Astounding Scripts for the Macintosh.

Geektools
  • Amazon

Most clocks show time in a complicated display of day, month, year, hours, minutes, and seconds. But how often have you just wanted to know whether the time is today, yesterday, or last week? This Python-based GeekTool geeklet will display the relative date on your desktop.

[toggle code]

Geektool alternative
  • #!/usr/bin/python
  • # -*- coding: utf-8 -*-
  • import optparse, datetime
  • days = ('yesterday', 'today', 'tomorrow')
  • parser = optparse.OptionParser('%prog')
  • parser.add_option('-d', '--day', type='choice', choices=days, default='today')
  • (options, slugs) = parser.parse_args()
  • today = datetime.datetime.fromordinal(datetime.date.today().toordinal())
  • future20 = datetime.datetime.now() + datetime.timedelta(minutes=20)
  • oneDay = datetime.timedelta(days=1)
  • oneWeek = datetime.timedelta(days=7)
  • if options.day 'today':
    • date = today
  • elif options.day 'tomorrow':
    • date = today + datetime.timedelta(days=1)
  • elif options.day 'yesterday':
    • date = today - datetime.timedelta(days=1)
  • else:
    • date = future20
  • #the future
  • if date >= today:
    • if date future20:
      • print '20 minutes into the future'
    • elif date today:
      • print 'Today'
    • elif date <= today + oneDay:
      • print 'Tomorrow'
    • elif date <= today + oneWeek:
      • print 'Next', date.strftime('%A')
    • elif (date.year today.year and date.month != today.month) or (date.year today.year+1 and date.month <= today.month):
      • print 'Next', date.strftime('%B')
    • else:
      • timeToFuture = date - today
      • print 'In', timeToFuture.days, 'Days'
  • #the past
  • elif date >= today - oneDay:
    • print 'Yesterday'
  • elif date >= today - oneWeek:
    • print 'Last', date.strftime('%A')
  • elif (date.year today.year and date.month != today.month) or (date.year today.year-1 and date.month >= today.month):
    • print 'Last', date.strftime('%B')
  • else:
    • timeToPast = today - date
    • print timeToPast.days, 'Days Ago'

I set the geeklet to refresh every 60 seconds to ensure that the relative clock is always correct.

If the current time is today, the script displays “today”. If it’s yesterday or tomorrow, then it displays that. If it’s within one week in either direction, it displays “next” or “last” and then the weekday name. And if it’s within the last or next twelve months, it does the same for the month name. Otherwise, it just says how many days to or since the current date.

The script uses Python’s datetime and timedelta classes to make these checks. I would have liked to use datetimes, dates, and timedeltas, but dates and datetimes are very different classes; there’s a datetime.date() method, for example, but no date.datetime(), and the datetime.today() method is really just datetime.now().

The timedelta class is used to create, basically, a time range to subtract from or add to a datetime; and when you subtract one datetime from another datetime, the result is a timedelta of the difference.

If you’d rather see how tomorrow relates to the current time, or how yesterday relates to the current time, specify “tomorrow” or “yesterday” to the --day option on the command line.

Geeklets

I haven’t had any need to display times, so I haven’t programmed it. If you end up needing times, however, it shouldn’t be difficult to extend the pattern I’ve started here to go down to hours or even minutes or seconds.

Keep this on your Desktop and you’ll never forget what today is!

GeekTool
“GeekTool is a System Preferences module for Mac OS 10.5. It lets you display on your desktop different kind of informations, provided by 3 default plugins.” The plugins let you monitor files (such as error logs), view images (such as live graphs), and display the results of command-line scripts.

More April Fool’s

I’m stuck in a computer program; now what?
“Help, I’ve been sucked into a computer program! What do I do?” Handy tips for how to successfully extricate yourself from the most hopeless of spaghetti code, the inner universe loop.
Can I legally use Gary Gygax’s name for my son?
It’s probably best to talk to a lawyer, or just avoid the issue altogether. Gaming copyright is a very complex issue, and best left to the experts or those with deep pockets. Have you considered naming him Sue?
Secular Humanist Pantheon
The Secular Humanist cult, while often oppressed, attracts intelligent, creative worshippers who subscribe to a rich and storied mythology. It will make a great addition to your role-playing game alongside more commonly-role-played mythologies such as Christianity, Buddhism, and Bokonism.

More GeekTool

icalBuddy and eventsFrom/to
Ali Rantakari’s icalBuddy has an error in the documentation for the “eventsFrom/to” command-line option. Rather than “tomorrow at time” use “time tomorrow”.
Apple Mail on the Desktop with GeekTool
Here’s a simple AppleScript to use with GeekTool to put your inbox on the Desktop.
GeekTool, TaskPaper, and XML
A script to convert a TaskPaper file to XML so as to filter it for specific tags and display the results on the Desktop.
GeekTool, Perl, and ANSI color codes
GeekTool is a great way to display the results of little scripts on your desktop. Using ANSI color codes can make those scripts even more useful. You can also change the status of the status button from “success” to “failure” depending on your script’s exit code.
Command-line mail on OS X: re-alpine and Geektool
If you do a lot of automated command-line scripts, you probably also generate a lot of mail to /var/mail. OS X only has the mail program built-in, and its GUI mail client hasn’t been able to add simple mail accounts since about OS X 10.2. Alpine can get you a better mail client, and Geektool can provide better notices.
GeekTool

More Python

Goodreads: What books did I read last week and last month?
I occasionally want to look in Goodreads for what I read last month or last week, and that currently means sorting by date read and counting down to the beginning and end of the period in question. This Python script will do that search on an exported Goodreads csv file.
Test classes and objects in python
One of the advantages of object-oriented programming is that objects can masquerade as each other.
Timeout class with retry in Python
In Paramiko’s ssh client, timeouts don’t seem to work; a signal can handle this—and then can also perform a retry.
Percentage-based random tables
Our current random item generator assumes that each item shows up as often as any other item. That’s very OD&D-ish. But AD&D uses percentage dice to weight toward some monsters and items more than others.
Parsing JSKit/Echo XML comments files
While I’m not a big fan of remote comment systems for privacy reasons, I was willing to use JSKit as a temporary solution because they provide an easy XML dump of posted comments. This weekend, I finally moved my main blog to custom comments; here’s how I parsed JSKit’s XML file.
28 more pages with the topic Python, and other related pages

In this week’s video, I look at GeekTool, a free system utility that lets you display images, text files, and the output of Unix commands on your desktop (or floating above other windows).

Download Macworld Video #106

• Format: MPEG-4/H.264

• Resolution: 480 x 272 (iPhone & iPod compatible)

• Size: 13.3MB

Geektool Alternative

GeekTool

• Length: 7 minutes

Data recovery wizard free edition. In the course of the video, I reference a collection of sites where you can find more powerful examples of what you can do with GeekTool. These include:

Geektools.com

  • Hints that mention GeekTool on macosxhints.com.
  • Ultimate GeekTool Setup on Keynote 2 Keynote.
  • GeekTool and bash one liners on Mac Geekery.
  • Geek to Live: Monitor your Mac and more with GeekTool on Lifehacker.
  • Mega Roundup of GeekTool Scripts on Francesco Mugnai’s blog (which contains links to many other sites).
  • In the video, I show one GeekTool entry that displays my external IP address, which can be useful if you’re trying to debug a network connectivity problem. The Unix source for that entry can be found buried in this hint on Mac OS X Hints. To save you the digging, though, here’s the command: curl --silent http://checkip.dyndns.org awk '{print $6}' cut -f 1 -d '<'. Just enter that as the Unix command, and you should see your external IP address in GeekTool.

To subscribe to the Macworld Video Podcast using iTunes 5 or later, click here.

Geektool Time

You can also see a complete archive of all our videos on Macworld’s YouTube channel. Subscribe to that channels and you will be notified whenever we post a new video.

Or just point your favorite podcast-savvy RSS reader to: http://feeds.macworld.com/macworld/video/