systemjilo.blogg.se

Geektool scripts
Geektool scripts











  1. GEEKTOOL SCRIPTS MANUAL
  2. GEEKTOOL SCRIPTS FULL
  3. GEEKTOOL SCRIPTS MAC

GEEKTOOL SCRIPTS MAC

I’ve tested this script using the latest version of GeekTool (available in the Mac App Store) using OSX Lion, It should work… but as a disclaimer I’m throwing this up as a ‘work in progress’ script, but should get the job done. I then integrated the OAuth app/token creation, while trying to make it as user-friendly as possible, limiting the amount of prerequisites to run this script to a minimum.

GEEKTOOL SCRIPTS MANUAL

It worked fine out the box, but after a bit of manual configuration, I started adding some pretty formatting then found myself adding some new features like a Twitter search or retweet monitoring etc…. I wasn’t having much luck until I started searching for a command line Twitter access using OAuth… then I stumbled on a blog post containing a Python script which could retrieve user timelines, post tweets etc. The main issue was any existing Twitter GeekTool scripts I found used basic authentication which is no longer supported by the Twitter API as it was replaced with OAuth authentication (which is good, but makes accessing the API authenticated a bit more difficult). I’ve been playing around with GeekTool recently and one of the first things I wanted to include was my Twitter timeline on my desktop which proved to be a more difficult task than I expected. It's basically a full-blown programming language, designed to deal with text files one line at a time, and it's really useful it's also something you can pick up a little bit at a time, if you're so inclined.Adding Twitter into GeekTool using OAuth!

GEEKTOOL SCRIPTS FULL

Type "man awk" in the terminal for a full description of the command. If max is not greater than zero, then something wrong happened (maybe ioreg doesn't have a line which says "MaxCapacity") and so return the character "?". If the variable max is greater than zero, then take the contents of the array labelled "CurrentCapacity", divide it by max, and multiply by 100. Next it prints out the result of the formula max>0?100*c/max:"?"which is an if-then statement (with the form test?true:false awk stole this notation from C). Second, it defines the variable max to be the contents of the array labelled "MaxCapacity" (which was defined in the first part of the process). First it sets OFMT="%.2f%%", which means to change the output format so that it outputs real numbers with two decimal places followed by a percentage sign (as above). The END segment means to run the following command after you're done reading in standard input. (Unlike in some languages, awk's arrays can be labelled with text, not just numbers.)

geektool scripts

Whenever column 3 ($3) contains the word "Capacity" ($3~/Capacity), it runs the command "c=$5", which stores the fifth column into an array (a box) labelled with the contents of the third column. This awk command starts by reading in each line of ioreg -l, one at a time. The printf command calculates $10/$5*100 (that is, the 10th column divided by the 5th column, times 100) and prints it as a floating-point number with 2 decimal places ("%.2f") followed by a percentage sign ("%%").Īwk '$3~/Capacity/ ' (So $5 is the 5th column's data and $10 is the 10th column's). This first awk command reads the standard input, one line at a time (if necessary I'm guessing only one line is being sent to it here), and splits the line into columns, the data in column c having the name $c.













Geektool scripts