Next, make the script executable and test it by executing: $ chmod a+x gt-ipinfo.sh. Create a new file called gt-ipinfo.sh in this directory with the following contents: #!/bin/sh external=$(curl -s | awk " fi I store my GeekTool scripts in ~/bin/gt-scripts/. Now open the Terminal and find a place to create your shell script. In the Command section of the Properties, we want to give it the path to a shell script to execute. ![]() You can move it around, resize it, and adjust the properties at this point. Drag the box to to the location on the desktop where you want it to be displayed. An empty box will appear and a Properties window will show up. As an illustration, we’ll create a Geeklet that displays the computer’s internal and external IP addresses.ĭrag the Shell icon to the desktop. Once the Preference Pane is installed, you can create a new “Geeklet” by dragging one of the icons to your desktop. The real power in GeekTool is displaying output from shell scripts, which makes the “Geek” in GeekTool apt for many. These can be used to display or tail the contents of files on the desktop (think log files), the output of shell scripts, and image graphics (like RRD or MRTG graphs), respectively.įor a lot of people, GeekTool may be nothing more than a novelty, but for system administrators and others, GeekTool can be a real boon. It comes with three modules: the file plugin, the shell plugin, and the image plugin. GeekTool is a fantastic System Preference Pane for Mac OS X that allows you to display a variety of different pieces of information directly on the desktop. Vincent Danen introduces GeekTool, a System Preference Pane for Mac OS X that allows you to display system information of your choice directly on the desktop. The "Result" tab should show you the non-completed items in your default todo list.Get system display options with GeekTool for the Mac If we run this script inside of Script Editor, we can see it working. Set theOutput to (theOutput & item i of theList as string) & linefeed & "-" & linefeed Repeat with i from 1 to (count of every item of theList) Set theList to theList & name of reminder i of list "Reminders" If reminder i of list "Reminders" is not completed then Repeat with i from 1 to (count of every reminder of list "Reminders") osascript /Users/MacBookPrime/Documents/Geeklets/TestScript.scpt The second repeat block adds some formatting to the previous list so the output looks a little nicer. The first goes through and grabs every reminder in the list "Reminders" (change this name if you have a different list in mind) that is not checked off and completed. With the information that I just learned in mind, I set up two repeat blocks. This verbiage is actually all I need to know to get going on a script. There are "lists" which contain "Reminders" that might or might not be "completed" and are identified by their "name". I set it to ten seconds but if you really need to the second accuracy, you'll have to refresh every second.īrowsing through here, I get the gist of the basic syntax. You'll have to set the refresh rate to be fairly fast on this one so the time stays accurate. Now set it to 48pt type and position it under the previous Geeklet. With this in mind, drag out a new Shell Geeklet and toss in the following code: date +"%l:%M" ![]() I'm not usually in such a poor mental state that I can't figure out if it's morning, afternoon or evening. I'll use the twelve hour clock with no zeros and no AM/PM. date '+%H' - 02 (hour, 24 hour clock, no zero)Īll I really want for this is the hour and minute.date '+%I' - 02 (hour, 12 hour clock, with zero). ![]() date '+%k' - 2 (hour, 24 hour clock, no zero).date '+%l' - 2 (hour, 12 hour clock, no zero).In fact, we use the same exact process as before, only this time we'll need to pick from the pool of date snippets that relate to the time: With all of that great knowledge that we gleaned from the previous step, adding the time to our desktop should be a cinch. Resize the container and set a refresh rate. I'm keeping things pretty simple so I went with white, 13pt Lucida Grande. In the Properties window, click on the button near the bottom that says "Click here to set font & color" and customize the text to your liking. Once you insert this code, your result should automatically update. %d'Īs you can see, I used the long form weekday format followed by a comma, a space, the short form month, a period, a space and finally the day of the month. Copy and paste the following code into the Command field. ![]() Now that we can see how to get all the pieces that we need, we can easily toss them all together into a single script. date '+%Y' - 2012 (year with four digits).date '+%e' - 1 (day of month without zero).date '+%d' - 01 (day of month with zero).See how that works? Here's a larger list that should come in handy.
0 Comments
Leave a Reply. |