12

Flat

Posted in System by dantodd 1955 days ago

Flat

A ridiculously complicated world time geeklet

v0.01 - April 13, 2014

Details

dan@diffusions.net

Why does this exist?

This applescript was created to try and generate nice looking geeklets.

There is a limitation to the current geektools that only images, plain text or shell commands can be displayed.

A webkit geeklet would be amazing and would remove the need to create an image.

I've tried to use ANSI esccape style formatting, but while that kind of worked, I prefered the look of different fonts on my desktop.

My dirty hack was to generate a nicely styled HTML file. Since that can't be displayed natively, the webkit2png script is used to create a PNG file.

Installation

Points of interest

  • Save this applescript with your other geeklets
  • Modify the place names to the ones of your choice
  • Lookup the WOEIDs of these places from [http://isithackday.com/geoplanet-explorer/]
  • Lookup the timezones of these places from [http://www.timeanddate.com/library/abbreviations/timezones/] or [http://en.wikipedia.org/wiki/Listoftzdatabasetime_zones]
  • Change units to 'f' for farenheiht or 'c' for celsius

System configuation

Modify the system configuation items as required

  • Unless your username is also dan, you will need to change the variable temp_path

Update / Script

  • create a shell geeklet on your desktop
  • the command is osascript /path/to/worldtime.scpt
  • optional: add to a unique group
  • update every 300 seconds (5 minutes)
  • force refresh of all geeklets

Display

  • create an image geeklet on your desktop (800 x 600)
  • link to your temppath/tempfile_png
  • optional: add to the same unique group
  • refresh every 60 s

Tidy Up

  • make the shell geeklet 1x1 in size to hide it

Styling and formating

Adjust as required. You will need to create ttf versions of your font and place them in stylefontpath. See the below section on Fondu for more information.

Dependencies

There are only two external required dependencies (other than geektools), curl and webkit2png. Fondu is also helpful. All can be acquired from homebrew.sh

Required depencies

  • curl
  • webkit2png

Homebrew

To install Homebrew (a *nix package manager for OSX) run:

$ ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"

curl

To install curl:

$ sudo port install curl

webkit2png

To install webkit2png run:

$ sudo port install webkit2png

fondu

To install fondu run:

$ sudo port install fondu

To convert font, go to the Font directory

$ sudo fondu fontname.ext (HelveticaNeue.dfont in my case)

Then copy the new set of ttf files to your stylefontpath

Conclusion

That's it. I've tried to explain what I have done by commenting through out my code.

Dan


Comments

User Avatar
-cj81499- 1955 days ago
This looks cool. I also like your desktop, specifically, the colored circle indicators on the side. Could you post a tutorial for them?
User Avatar
dantodd 1954 days ago
Thank you, -cj81499-.

I borrowed the idea from another geeklet. I'll see what I can knock up for a progress bar tutorial and if I can find the original geeklet.
User Avatar
-cj81499- 1951 days ago
Sounds good. Any ETA for the tutorial?
User Avatar
dantodd 1948 days ago
Here you go -cj81499-

http://www.macosxtips.co.uk/geeklets/system/circular-display-icons-tutorial/

Log in to comment or register here.