Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.
Status
Not open for further replies.
I wrote this up real quick. It gives you just the current temperature number. If you are looking for anything added to it just let me know...

Code:
curl --silent http://www.weatherlink.com/user/stiencabin/ | grep "glamor_temp" | sed -e :a -e 's/<[^>]*>//g;/</N;//ba' | sed 's/ //g' | sed 's/°/./g'| cut -d "." -f 1

Perfect! I'd love a degree symbol, but wouldn't know how to add it without mucking it up.
 

Attachments

  • Screen shot 2011-11-19 at 17.41.45 .png
    Screen shot 2011-11-19 at 17.41.45 .png
    18.3 KB · Views: 1,958
Last edited:
Perfect! I'd love a degree symbol, but wouldn't know how to add it without mucking it up.

This should work and show a degree symbol..
Code:
curl --silent http://www.weatherlink.com/user/stiencabin/ | grep "glamor_temp" | sed -e :a -e 's/<[^>]*>//g;/</N;//ba' | sed 's/ //g' | sed 's/°/./g'| cut -d "." -f 1 | sed 's/$/°/'
 
@xtacocorex
Thanks for the reply.

I modified a battery script.
original script
My script

But the charging time calculator doesn't work good. I try repair this, but no good.
Orig: mins=`echo "(${status[0]}-${status[3]})*60/${status[4]}"|bc`
My: mins=`echo "(${status[0]}-${status[3]})*120/${status[4]}"|bc`

Any idea?

My script use the battery icons. If the battery level changes, then the battery icon will change.

Image
Image

My English knowledge isn't the best. I hope you understand me.

Edit: The original charger script is correct. The apple battery calculator and the script show same time. But the iSata menus show a different time.


I can't quite get this code to work... I get the percentage, if it charging, charged, or not, the time until full/empty however I cannot get the icons to appear. I have some custom icons that I made and I tried changing the file paths it shows but I have had no luck. Any help would be appreciated (including modified code)...
 
Anyone have a script for MOG?

I've seen lots of geeklets for iTunes and Spotify, but nothing for MOG. Does anyone have one they'd be willing to share?

Many thanks!
 
I have the weirdest problem with a python script used for geektool. It's getting data from google tasks to show on my desktop and while it looks correct in the terminal geektool fails as soon as a row appears containing a swedish character (åäö). If I print('åäö') in the .py it works great, but somehow the characters coming from google tasks are different and I have abs no idea on how to fix this. I mean how can I replace characters that looks correct??

Script:

Code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from apiclient.discovery import build
from apiclient.oauth import OAuthCredentials
from oauth2client.file import Storage
from oauth2client.client import OAuth2WebServerFlow
from oauth2client.tools import run
from string import find
from collections import OrderedDict
from argparse import ArgumentParser
from operator import itemgetter

import httplib2
import sys
import datetime as dt
import time
import os
import readline
import keys

arguments = False
service = None
TaskLists = {}
IDToTitle = {}
TaskNames = []
UNCHANGED = 0
TOGGLED = 1
DELETED = 2
bold = lambda x : '\x1b[1m' + x + '\x1b[0m'
strike = lambda x : '\x1b[9m' + x + '\x1b[0m'


class Completer():
    def __init__(self):
        self.matches = []
        self.completions = []
        self.DEBUG = False
     
    def complete_task_names(self, text, state):
        self.completions = TaskNames
        response = None
       
        if state is 0:
            if text:
                self.matches = [s for s in self.completions 
                                if s and s.startswith(text)]
            else:
                self.matches = self.completions[:]

        try:
            response = self.matches[state]
        except IndexError:
            pass
        
        return response
    
    def complete_none(self, text, state):
        return None

def search_task(substr):
    length = len(substr)
    matches = {}
    i = 1

    for tasklistID in TaskLists:
        for taskID in TaskLists[tasklistID]:
            task = TaskLists[tasklistID][taskID]
            if task['modified'] is DELETED:
                continue
            index = task['title'].find(substr)
            if index != -1:
                matches[i] = (tasklistID, task, index)
                i += 1

    # No matches
    if i is 1:
        return None
    # Unique match
    elif i is 2:
        return matches[i-1][:2]
    # Multiple matches
    else:
        # Print all matches
        for ii in xrange(1, i):
            (listID, task, index) = matches[ii]
            title = task['title']
            print '({0}): {1} : {2}{3}{4}'.format(ii, IDToTitle[listID], title[:index], \
                    bold(substr), title[index + length:]) 
        while True:
            choice = raw_input('Multiple matches found. Enter number of your choice: ')
            try:
                return matches[int(choice)][:2]
            except:
                print 'Invalid input. Please try again.'

def add_task(taskInfo):
    matches = {}
    i = 1
    choice = 1
    (listID, task) = taskInfo
    
    if listID is not None:
        matches[choice] = listID
    else:
        for tasklistID in TaskLists:
            matches[i] = tasklistID
            i += 1

        # No task lists found - report error
        if i is 1:
            print 'No task lists found.'
            return
        
        # In case of multiple lists, decide which one
        if i > 2:
            for ii in xrange(1, i):
                print '({0}): {1}'.format(ii, IDToTitle[matches[ii]]) 
            while True:
                try:
                    choice = int(raw_input('Multiple lists found. Enter number of your choice: '))
                    # Check if input is a valid choice
                    dic = TaskLists[matches[choice]]
                    break
                except:
                    print 'Invalid input. Please try again.'

    dic = TaskLists[matches[choice]]
    newTask = None

    if 'parent' in task:
        newTask = service.tasks().insert(tasklist = matches[choice], \
                parent = task['parent'], body = task).execute()
        # Re-insert the new task in order
        newDict = OrderedDict()
        for tt in dic:
            newDict[tt] = TaskLists[matches[choice]][tt]
            if tt is task['parent']:
                newDict[newTask['id']] = newTask
        TaskLists[matches[choice]] = newDict
    else:
        newTask = service.tasks().insert(tasklist = matches[choice], body = task).execute()
        TaskLists[matches[choice]][newTask['id']] = newTask

    # Update records
    IDToTitle[newTask['id']] = newTask['title']
    TaskNames.append(newTask['title'])
    newTask['modified'] = UNCHANGED

def remove_task(taskInfo):
    global TaskLists
    (listID, task) = taskInfo

    # If already deleted, do nothing
    if task['modified'] is DELETED:
        return

    # Delete the given task
    task['modified'] = DELETED
    # Tidy up
    del IDToTitle[task['id']]
    TaskNames.remove(task['title'])
    
    # Also delete all children of deleted tasks
    for taskID in TaskLists[listID]:
        t = TaskLists[listID][taskID]
        if 'parent' in t and t['parent'] in TaskLists[listID] and \
            TaskLists[listID][t['parent']]['modified'] is DELETED:
            t['modified'] = DELETED
            if t['id'] in IDToTitle:
                del IDToTitle[t['id']]
                TaskNames.remove(t['title'])

def toggle_task(taskInfo):
    global TaskLists
    (listID, task) = taskInfo

    # If already deleted, do nothing
    if task['modified'] is DELETED:
        return

    # toggle_task the given task
    task['modified'] = TOGGLED
    if task['status'] == 'needsAction':
        task['status'] = 'completed'
    else:
        task['status'] = 'needsAction'
        if 'completed' in task:
            del task['completed']

    # Write back changes locally
    TaskLists[listID][task['id']] = task    
    prevs = [task['id']]

    # Also toggle all children who parents were toggled
    for taskID in TaskLists[listID]:
        t = TaskLists[listID][taskID]
        if t['status'] is DELETED:
            continue
        if 'parent' in t and t['parent'] in prevs:
            t['status'] = TaskLists[listID][t['parent']]['status']
            if t['status'] == 'needsAction' and 'completed' in t:
                del t['completed']
            prevs.append(t['id'])
            t['modified'] = TOGGLED
            TaskLists[listID][t['id']] = t

def get_data():
    global TaskLists

    # Only retrieve data once per run
    if TaskLists != {}:
        return 

    # Fetch task lists
    tasklists = service.tasklists().list().execute()
    
    # No task lists
    if 'items' not in tasklists:
        return

    # Over all task lists
    for tasklist in tasklists['items'][0:1]:
        # Handle repeats
        if tasklist['title'] in IDToTitle:
            continue
        IDToTitle[tasklist['id']] = tasklist['title']
        TaskLists[tasklist['id']] = OrderedDict()
        tasks = service.tasks().list(tasklist = tasklist['id']).execute()
        # No task in current list
        if 'items' not in tasks:
            continue
        # Over all tasks in a given list
        for task in tasks['items']:
            TaskNames.append(task['title'])
            IDToTitle[task['id']] = task['title']
            # Set everything to be initially unmodified
            task['modified'] = UNCHANGED
            TaskLists[tasklist['id']][task['id']] = task

def put_data():
    global TaskLists

    # Nothing to write home about
    if TaskLists == {}:
        return

    for tasklistID in TaskLists:
        for taskID in TaskLists[tasklistID]:
            task = TaskLists[tasklistID][taskID]
            if task['modified'] is UNCHANGED:
                continue
            elif task['modified'] is TOGGLED:
                service.tasks().patch(tasklist = tasklistID, task = taskID, 
                                      body = {'status': task['status']}).execute()
            elif task['modified'] is DELETED:
                service.tasks().delete(tasklist = tasklistID, task = taskID).execute()

def print_all_tasks():
    global TaskLists
    #arrow = u'\u2192'
    arrow = '>'
    tab = '  '

    # No task lists
    if TaskLists is {}:
        print 'Found no task lists.'
        return

    numLists = len(TaskLists)
    #print 'Found {0} task list(s):'.format(numLists)

    for tasklistID in TaskLists:
        # Use a dictionary to store the indent depth of each task
        depthMap = { tasklistID : 0 }
        depth = 1

        # Print task name
        #print tab * depth, IDToTitle[tasklistID]
        
        # No tasks
        if TaskLists[tasklistID] is {}:
            continue

        for taskID in TaskLists[tasklistID]:
            task = TaskLists[tasklistID][taskID]
            if task['modified'] is DELETED:
                continue
            depth = 2
            isCompleted = (task['status'] == 'completed')
  
            # NO COMPLETED TASKS PLEASE!
	    if isCompleted:
                continue
            
            # Set the depth of the current task
            if 'parent' in task and task['parent'] in depthMap:
                depth = depthMap[task['parent']] + 1
            depthMap[task['id']] = depth

	    #print 'starting up…'
	    #print 'packet att hämta'
            #return
           
	    # Print strike-through if task has already been completed
            if isCompleted:
                #print tab * depth, u'\u2611', task['title']
		print task['title']
            else:
                #print tab * depth, u'\u2610', task['title']
		print task['title']

            # Print due date if specified
            if 'due' in task:
                date = dt.datetime.strptime(task['due'], '%Y-%m-%dT%H:%M:%S.%fZ')
                output = date.strftime('%a, %b %d, %Y')
                if isCompleted:
                    print tab * (depth + 1), arrow, strike('Due Date: {0}'.format(output))
                else:
                    print tab * (depth + 1), arrow, 'Due Date: {0}'.format(output)

            # Print notes if specified
            if 'notes' in task:
                if isCompleted:
                    print tab * (depth + 1), arrow, strike('Notes: {0}'.format(task['notes']))
                else:
                    print tab * (depth + 1), arrow, 'Notes: {0}'.format(task['notes'])

def handle_input_args(argv):
    action = ''.join(argv['action'])
    
    if action is 'l':
        print_all_tasks()
        return
    elif action is 'a':
        task = { 'title' : ''.join(argv['title']) }
        if argv['date'] is not None:
            dstr = ''.join(argv['date'])
            d = time.strptime(dstr, "%m/%d/%y")
            task['due'] = str(d.tm_year) + '-' + str(d.tm_mon) + '-' + \
            str(d.tm_mday) + 'T12:00:00.000Z'
        if argv['note'] is not None:
            task['notes'] = ''.join(argv['note'])
        if argv['parent'] is not None:
            ret = search_task(''.join(argv['parent']))
            if ret is None:
                print 'No matches found for parent.'
            else:
                (listID, parentTask) = ret
                task['parent'] = parentTask['id']
                print 'Adding task...'
                add_task((listID, task))
                return
        print 'Adding task...'
        add_task((None, task))
    elif action is 'r':
        ret = search_task(''.join(argv['title']))
        if ret is None:
            print 'No match found.'
        else:
            print 'Removing task...'
            remove_task(ret)
    elif action is 't':
        ret = search_task(''.join(argv['title']))
        if ret is None:
            print 'No match found.'
        else:
            print 'Toggling task...'
            toggle_task(ret)
    
    if argv['list'] is True:
        print_all_tasks()

def handle_input(c):
    completer = Completer()
    c_name = completer.complete_task_names
    c_none = completer.complete_none
    readline.set_completer(c_none)

    if c is 'a':
        t = dt.date.today()

        title = raw_input("Name of task: ")
        while title is '':
            print 'Please enter name for task.'
            title = raw_input("Name of task: ")
            
        task = { 'title' : title }
        month = raw_input("Month [MM]: ")
        day = raw_input("Day [DD]): ")
        year = raw_input("Year [YYYY]: ")

        if not (day is '' and month is '' and year is ''):
            if day is '' or not day.isdigit():
                day = t.day
            if month is '' or not month.isdigit():
                month = t.month
            if year is '' or not year.isdigit():
                year = t.year
            task['due'] = str(year) + '-' + str(month) + '-' + str(day) + 'T12:00:00.000Z'

        notes = raw_input("Notes: ")
        if notes is not '':
            task['notes'] = notes
    
        readline.set_completer(c_name)
        parent = raw_input("Name of parent task: ")

        if parent is not '':
            ret = search_task(parent)
            if ret is None:
                print 'No matches found for parent.'
            else:
                (listID, parentTask) = ret
                task['parent'] = parentTask['id']
                print 'Adding task...'
                add_task((listID, task))
                return
        print 'Adding task...'
        add_task((None, task))
    elif c is 'l':
        print_all_tasks()
    elif c is 'r':
        readline.set_completer(c_name)
        substr = raw_input("Name of task: ")
        ret = search_task(substr)
        if ret is None:
            print 'No match found.'
        else:
            print 'Removing task...'
            remove_task(ret)
    elif c is 't':
        readline.set_completer(c_name)
        substr = raw_input("Name of task: ")
        ret = search_task(substr)
        if ret is None:
            print 'No match found.'
        else:
            print 'Toggling task...'
            toggle_task(ret)

def parse_arguments():
	global arguments

	# Parse arguments
	if len(sys.argv) > 1:
		arguments = True
		parser = ArgumentParser(description = "A Google Tasks Client.")
		subparsers = parser.add_subparsers(dest = 'action')

		parser_a = subparsers.add_parser('a')
		parser_a.add_argument('-l', '--list', action = 'store_true', \
		default = False, help = 'If given, the updated lists will be printed\
		after execution')
		parser_a.add_argument('-t', '--title', nargs = 1, required = True, \
		help = 'This non-optional argument specifies the name of the task.')
		parser_a.add_argument('-d', '--date', nargs = 1, \
		help = 'This optional argument must of the of the form MM/DD/YYYY.')
		parser_a.add_argument('-n', '--note', nargs = 1, \
		help = 'This optional argument can be any quotation-enclosed string.')
		parser_a.add_argument('-p', '--parent', nargs = 1, \
		help = 'This optional argument specifies the name of the task.')

		parser_r = subparsers.add_parser('r')
		parser_r.add_argument('-l', '--list', action = 'store_true', \
		default = False, help = 'If given, the updated lists will be printed\
		after execution')
		parser_r.add_argument('-t', '--title', nargs = 1, required = True, \
		help = 'This non-optional argument specifies the name of the task.')

		parser_l = subparsers.add_parser('l')

		parser_t = subparsers.add_parser('t')
		parser_t.add_argument('-l', '--list', action = 'store_true', \
		default = False, help = 'If given, the updated lists will be printed\
		after execution')
		parser_t.add_argument('-t', '--title', nargs = 1, required = True, \
		help = 'This non-optional argument specifies the name of the task.')

		sys.argv = vars(parser.parse_args())

def authenticate():
	global service

	#print 'Verifying authentication...'
	f = keys.Auth('/Users/tigersoul/Documents/GeekTool Scripts/keys.txt')

	# OAuth 2.0 Authentication
	FLOW = OAuth2WebServerFlow(
		client_id=f.get_client_ID(),
		client_secret=f.get_client_secret(),
		scope='https://www.googleapis.com/auth/tasks',
		user_agent='Tasky/v1')

	# If the Credentials don't exist or are invalid, run through the native client
	# flow. The Storage object will ensure that if successful the good
	# Credentials will get written back to a file.
	storage = Storage('/Users/tigersoul/Documents/GeekTool Scripts/tasks.dat')
	credentials = storage.get()

	if credentials is None or credentials.invalid:
	  credentials = run(FLOW, storage)

	http = httplib2.Http()
	http = credentials.authorize(http)

	# The main Tasks API object
	service = build(serviceName='tasks', version='v1', http=http, 
					developerKey=f.get_API_key())

def main(argv):
    
    #print 'test'
    #return


    #print 'Retrieving task lists...'
    get_data()

    if arguments:
        handle_input_args(argv)
    else:
        readline.parse_and_bind('tab: complete')
        readline.set_completer_delims(readline.get_completer_delims()[1:])
        print_all_tasks()
        while True:
            readIn = raw_input('[a]dd, [r]emove, [l]ist, [t]oggle, [q]uit: ')
            if readIn is '' or readIn is 'q':
                break
            handle_input(readIn)

    #print 'Sending changes...'
    #put_data() # only viewing so no point in sending anything

if __name__ == '__main__':
	parse_arguments()
	authenticate()
	main(sys.argv)
(I'm of course using the script with the l (L) parameter)
 
Last edited by a moderator:
Hi guys

Extremely new to geek tool (2 days) in fact. I'm figured out the basic and can do date, time, day etc. However the time only changes/update when I click refresh in geek tool itself. How can I fix that?

Also I would love to have weather forecast, but totally lost reading through the thread on how to get it done. I'm in the Caribbean (St. Kitts and Nevis) to be exact. Can someone help.

Thanks

Foxy
 
I have the weirdest problem with a python script used for geektool. It's getting data from google tasks to show on my desktop and while it looks correct in the terminal geektool fails as soon as a row appears containing a swedish character (åäö). If I print('åäö') in the .py it works great, but somehow the characters coming from google tasks are different and I have abs no idea on how to fix this. I mean how can I replace characters that looks correct??

(I'm of course using the script with the l (L) parameter)

Is the Geeklet set to unicode?

Also, it helps to use the code tags when pasting code. This seems like a very cool script, but trying to figure out the indentation is a nightmare.
 
Is the Geeklet set to unicode?

Also, it helps to use the code tags when pasting code. This seems like a very cool script, but trying to figure out the indentation is a nightmare.

Sorry I couldn't remember the tag name of the code tag... I fixed it, it was a matter of encoding the returned strings when print'ing or the script fails, not in the terminal but when used in geektool. If anyone's interested I can post the full working script. It shows tasks overdue and for today, but it's a hacked up mess I basically took a cli client in python and transformed it for my needs in geektool.
 
Hi guys

Extremely new to geek tool (2 days) in fact. I'm figured out the basic and can do date, time, day etc. However the time only changes/update when I click refresh in geek tool itself. How can I fix that?

Also I would love to have weather forecast, but totally lost reading through the thread on how to get it done. I'm in the Caribbean (St. Kitts and Nevis) to be exact. Can someone help.

Thanks

Foxy

Damn Kitticians lol

For the time, are you sure you have set the refresh rate to something other than zero ? Beneath where you have input the command there is a box to refresh every X seconds.

For the Weather, it depends on which script you are using. I use the one posted by CoolEnuForAMac that is popular on YouTube. Her instructions are clear and accurate. You might want to try that first. Search for "geektool weather" on YouTube or click the link below. I have changed the code for you so you can just use what I have posted but please do watch the video first.

GeekTool Weather from CoolEnufForAMac

Incidently I was able to get the weather for The Valley in Anguilla so you should have no trouble getting it for Basseterre in St. Kitts :) (private joke between you and I ). The rss code you would need for Basseterre weather is:

Code:
SCXX0001&u=c

There are two parts for the Weather image. One geeklet collects the image from yahoo and stores it on your computer, a second geeklet displays that image. Below I have given you the correct code to get both parts working without any changes.

The full code to collect the Weather image geeklet will be:

Code:
curl --silent "http://uk.weather.yahoo.com/saint-kitts-and-nevis/saint-george-basseterre/basseterre-161849/" | grep "forecast-icon" | sed "s/.*background\\:url(\\'\\(.*\\)\\')\\;\\ _background.*/\\1/" | xargs curl --silent -o /tmp/your_user_name_weather.png

Please note I'm in the UK so I'm going to Yahoo's UK site but it is supplying me with your weather. Also note that what you call the image and where you store it may differ. If there is more than one user of your mac then give the image your user name in case all of you want to be running this geek setup. I have in the code above stored the image as
Code:
/tmp/your_user_name_weather.png

the full code to Display the Weather image will be
Code:
file:///tmp/your_user_name_weather.png

The full code for the current conditions geeklet will be

Code:
curl --silent "http://xml.weather.yahoo.com/forecastrss?p=SCXX0001&u=c" | grep -E '(Current Conditions:|C<BR)' | sed -e 's/Current Conditions://' -e 's/<br \/>//' -e 's/<b>//' -e 's/<\/b>//' -e 's/<BR \/>//' -e 's/<description>//' -e 's/<\/description>//'

For the 2 day forecast geeklet you will need:

Code:
curl --silent "http://xml.weather.yahoo.com/forecastrss?p=SCXX0001&u=c" | grep -E '(High:)' | sed -e 's/<BR \/>//' -e 's/<b>//' -e 's/<\/b>//' -e 's/<BR \/>//' -e 's/<br \/>//'

Hope this helps. If you want more geeklets, I have posted a few of my own here

This site will also show you many more geeklets. Good luck.
 
Last edited:
Damn Kitticians lol

For the time, are you sure you have set the refresh rate to something other than zero ? Beneath where you have input the command there is a box to refresh every X seconds.

For the Weather, it depends on which script you are using. I use the one posted by CoolEnuForAMac that is popular on YouTube. Her instructions are clear and accurate. You might want to try that first. Search for "geektool weather" on YouTube or click the link below. I have changed the code for you so you can just use what I have posted but please do watch the video first.

GeekTool Weather from CoolEnufForAMac

Incidently I was able to get the weather for The Valley in Anguilla so you should have no trouble getting it for Basseterre in St. Kitts :) (private joke between you and I ). The rss code you would need for Basseterre weather is:

Code:
SCXX0001&u=c

There are two parts for the Weather image. One geeklet collects the image from yahoo and stores it on your computer, a second geeklet displays that image. Below I have given you the correct code to get both parts working without any changes.

The full code to collect the Weather image geeklet will be:

Code:
curl --silent "http://uk.weather.yahoo.com/saint-kitts-and-nevis/saint-george-basseterre/basseterre-161849/" | grep "forecast-icon" | sed "s/.*background\\:url(\\'\\(.*\\)\\')\\;\\ _background.*/\\1/" | xargs curl --silent -o /tmp/your_user_name_weather.png

Please note I'm in the UK so I'm going to Yahoo's UK site but it is supplying me with your weather. Also note that what you call the image and where you store it may differ. If there is more than one user of your mac then give the image your user name in case all of you want to be running this geek setup. I have in the code above stored the image as
Code:
/tmp/your_user_name_weather.png

the full code to Display the Weather image will be
Code:
file:///tmp/your_user_name_weather.png

The full code for the current conditions geeklet will be

Code:
curl --silent "http://xml.weather.yahoo.com/forecastrss?p=SCXX0001&u=c" | grep -E '(Current Conditions:|C<BR)' | sed -e 's/Current Conditions://' -e 's/<br \/>//' -e 's/<b>//' -e 's/<\/b>//' -e 's/<BR \/>//' -e 's/<description>//' -e 's/<\/description>//'

For the 2 day forecast geeklet you will need:

Code:
curl --silent "http://xml.weather.yahoo.com/forecastrss?p=SCXX0001&u=c" | grep -E '(High:)' | sed -e 's/<BR \/>//' -e 's/<b>//' -e 's/<\/b>//' -e 's/<BR \/>//' -e 's/<br \/>//'

Hope this helps. If you want more geeklets, I have posted a few of my own here

This site will also show you many more geeklets. Good luck.


Hehehehehe it's Kittitians (with a "t") but it was cool and funny at the same time seeing it being used. I guess you are indeed familiar with us. (•‿•)

Thanks for the response. I wasn't sure I would get one I have been checking for two days.

Yes I do have it set at 3600 and just today wonder if that was to much time or if I need to put anything with it.

I will check out the other stuff you posted. THANK YOU EVER SO MUCH. I will indeed watch the video as I need to learn and all this is greek to me.

I will keep you posted. IYDM!

Foxy
 
Last edited:
Geektool aesthetics help

I have no clue if it is even possible or not but can a geeklet (shell or image) be rotated. I am trying to put a desktop design together and this would really help. I am not fantastic at coding so if there any script or code you can think of I would appreciate it.
 
Hehehehehe it's Kittitians (with a "t") but it was cool and funny at the same time seeing it being used. I guess you are indeed familiar with us. (•‿•)

Thanks for the response. I wasn't sure I would get one I have been checking for two days.

Yes I do have it set at 3600 and just today wonder if that was to much time or if I need to put anything with it.

I will check out the other stuff you posted. THANK YOU EVER SO MUCH. I will indeed watch the video as I need to learn and all this is greek to me.

I will keep you post. IYDM!

Foxy

I'll use the excuse that it was very late at night for me when I wrote it, but yes, I did know it was a "t" and not a "c" (hangs head in shame :) ) My Father was from Anguilla and I have an adopted Aunt from St.Kitts. She will beat me if she ever finds out !

I think you may be leaving it too long to update the time as you have said. 3600 seconds means that it will only refresh itself once an hour, as there are 3600 seconds in an hour. At the very least you want the time geeklet refreshing itself once every 60 seconds so that it will be accurate to within a minute. If you have a recent (actually almost any) Mac, you should be able to set the refresh rate to 1 second, with no negative impact on the response of your machine when doing other tasks at the same time.

I have several geeklets being refreshed between every 1 - 10 seconds and others that refresh only once every 5 - 15 minutes. My MacBook Pro cpu idles at about 4% with them all running.

The weather geeklets once you have them working should be fine being refreshed once every 900 seconds (15 minutes). If you feel your machine is having to work too hard you can always increase the refresh times.

I have found that sometimes when editing a geeklet and you have them all open, the cpu use can become higher than usual but it will settle down again once you have finished editing.

Good luck and post again if you have any further questions. I'm also relatively new to macs but I will try to help if I can.
 
Here's my current desktop.

Just discovered Geektool yesterday, and I'm having such a blast tinkering around with it! What a fabulous program, even for those with limited technical knowledge.




Can anyone provide the code for a calendar like this? its awesome and i cant figure it out for the life of me
 
I'll use the excuse that it was very late at night for me when I wrote it, but yes, I did know it was a "t" and not a "c" (hangs head in shame :) ) My Father was from Anguilla and I have an adopted Aunt from St.Kitts. She will beat me if she ever finds out !

I think you may be leaving it too long to update the time as you have said. 3600 seconds means that it will only refresh itself once an hour, as there are 3600 seconds in an hour. At the very least you want the time geeklet refreshing itself once every 60 seconds so that it will be accurate to within a minute. If you have a recent (actually almost any) Mac, you should be able to set the refresh rate to 1 second, with no negative impact on the response of your machine when doing other tasks at the same time.

I have several geeklets being refreshed between every 1 - 10 seconds and others that refresh only once every 5 - 15 minutes. My MacBook Pro cpu idles at about 4% with them all running.

The weather geeklets once you have them working should be fine being refreshed once every 900 seconds (15 minutes). If you feel your machine is having to work too hard you can always increase the refresh times.

I have found that sometimes when editing a geeklet and you have them all open, the cpu use can become higher than usual but it will settle down again once you have finished editing.

Good luck and post again if you have any further questions. I'm also relatively new to macs but I will try to help if I can.

Thank you that worked. MBP is barely a year old and could more than handle it.

I have been really busy and have not done much more but just wanted to update you for now.

Will keep you posted.

Foxy

PS yeah you should be ashamed and be punished for the Kittician mistake, considering :)
 
Anyone care to help with iTunes

I have been watching some tutorials on how to use the iTunes now playing option on geek tool and just can't seem to figure it out or figure out what I'm missing. If anyone is familiar with this and could help that would be great thanks!
 
Is this a GeekTool program?

I saw this on the Itunes App Store for GeekTool.

On the lower Left of the screenshot is a music player? Assumably syncing with iTunes or something.

Does anyone know what program or script this is?
It's beautiful!

Screenshot2011-11-30at72918PM.png


Thank you!
-Kelley
 
Last edited by a moderator:
Geektool surf and/or tide forecast?

I'm a Geektool newbie (just have time/date/weather forecast) - Do any of you happen to know how to get wave conditions and/or tide forecasts to load via geek tool?
 
Can anyone provide the code for a calendar like this? its awesome and i cant figure it out for the life of me

here you go.
Code:
#!/usr/bin/env ruby
#
# Author: Robert Jorgenson
# Author email: rjorgenson@gmail.com
require 'Date'
ABBR_DAYNAMES = {0, 'Su', 1, 'Mo', 2, 'Tu', 3, 'We', 4, 'Th', 5, 'Fr', 6, 'Sa'}

def days_in_month(year, month)
  return (Date.new(year, 12, 31) << (12 - month)).day
end

def day_in_month(year, month, day)
  return Date.new(year, month, day).wday
end

def build_day_array(year, month)
  day_array = Array.new
  for d in (1..days_in_month(year, month))
    day_array[d] = ABBR_DAYNAMES[day_in_month(year, month, d)]
  end
  day_array.shift
  return day_array * " "
end

def build_separator(year, month)
  color = "\e[30m" #black
  #color = "\e[37m" #uncomment for white
  separator_string = "██" # change this to change separator, best if 2 characters wide
  close = "\e[0m" # don't change this
  separator = Array.new
  for d in (1..days_in_month(year, month))
    if year == Time.now.year && month == Time.now.month && d == Time.now.day then
      separator[d] = "#{color}#{separator_string}#{close}"
    else
      separator[d] = "#{separator_string}"
    end
  end
  separator.shift
  return separator * "█"
end

def build_date_array(year, month)
  date_array = Array.new
  for d in (1..days_in_month(year, month))
    date_array[d] = d
  end
  date_array.shift
  date_array.each do |d|
    if d < 10 then
      date_array[(d-1)] = "0#{d}"
    end
  end
  return date_array * " "
end

year = Time.now.year
month = Time.now.month

puts build_day_array(year, month)
puts build_separator(year, month)
puts build_date_array(year, month)
just put this code into a shell geeklet. you can change some parameters like the color of "today" marker and the separator symbol.
have fun!
 
I saw this on the Itunes App Store for GeekTool.

On the lower Left of the screenshot is a music player? Assumably syncing with iTunes or something.

Does anyone know what program or script this is?
It's beautiful!

Image

Thank you!
-Kelley

The program is called Bowtie. Once installed you can download many themes and you can then choose the one you want. The theme pictured is called Neon by zb3k
 
Last edited:
I have been watching some tutorials on how to use the iTunes now playing option on geek tool and just can't seem to figure it out or figure out what I'm missing. If anyone is familiar with this and could help that would be great thanks!

Most methods of doing this involve 2 general steps; placing the script somewhere on your PC, usually in your document folder and then having the geeklet run that script every second.

I use 2 scripts that I obtained and I modified them so that you simply put the code directly into the geeklet.

My first geeklet displays the current track being played and the %age progress of that track.

My second geeklet displays the previous track and the next track in the playlist.

If you have itunes paused the first script will indicate this. If itunes is not running I have modified my scripts to display nothing.

Place the following into a shell geeklet to display the current track info, I'm uncertain of the original writer of the script but many have used this in slightly amended forms; again set the refresh rate to 1 sec:

Code:
DATA=$(osascript -e 'tell application "System Events"
	set myList to (name of every process)
end tell

if myList contains "iTunes" then
	tell application "iTunes"
		set trackname to name of current track
		set artistname to artist of current track
		set albumname to album of current track
		set stars to (rating of current track) / 20 as integer
		set trackduration to duration of current track
		set trackposition to player position
		set elapsed to round (trackposition / trackduration * 100)
		
		if player state is paused then
			set output to "" & trackname & " - " & artistname & " (" & albumname & ") " & "| " & "paused at " & elapsed & "%"
		else
			set output to "" & trackname & " - " & artistname & " (" & albumname & ") " & "| " & elapsed & "%"
			
		end if
	end tell
else
	set output to ""
	
end if ')

echo $DATA

Place the following into a second shell geeklet to obtain the previous and next tracks. The original code was submitted to thisgeeklet site site by thcousins; set the refresh rate to 1 sec.

Code:
DATA=$(osascript -e 'tell application "System Events"
	set myList to (name of every process)
end tell

if myList contains "iTunes" then
	tell application "iTunes"
		if player state is stopped then
			set output to ""
		else if shuffle of current playlist is true then
			set output to "◀◀ (shuffle) new_line" & "►► (shuffle)"
		else
			set X to (index of current track)
			set Y to (index of last track) of current playlist
			
			if X = Y then
				set LAST_TRACK to name of track (X - 1) of current playlist
				set LAST_ARTIST to artist of track (X - 1) of current playlist
				set output to "◀◀ " & LAST_TRACK & " - " & LAST_ARTIST & "new_line ►► None"
				
			else if X - 1 = 0 then
				set NEXT_TRACK to name of track (X + 1) of current playlist
				set NEXT_ARTIST to artist of track (X + 1) of current playlist
				set output to "◀◀ None new_line" & "►► " & NEXT_TRACK & " - " & NEXT_ARTIST
			else
				set LAST_TRACK to name of track (X - 1) of current playlist
				set LAST_ARTIST to artist of track (X - 1) of current playlist
				set NEXT_TRACK to name of track (X + 1) of current playlist
				set NEXT_ARTIST to artist of track (X + 1) of current playlist
				set output to "◀◀ " & LAST_TRACK & " - " & LAST_ARTIST & "new_line" & "►► " & NEXT_TRACK & " - " & NEXT_ARTIST
			end if
		end if
	end tell
end if')

echo $DATA | awk -F new_line '{print $1}'
echo
echo
echo 
echo $DATA | awk -F new_line '{print $2}'

If you "shuffle" your playlists the second script cannot anticipate what song iTunes will randomly select so it will simple display that shuffle is enabled rather than give erroneous track listings. The first and main script displaying your song info is always correct so no niggles there.

The second geeklet display "wraps around" the main geeklet. To reduce or increase the distance between the "previous" and "next" info simply remove or add "echo" lines between the last 5 lines of the second script; I use three echo lines, you may need more or less of them:

Code:
echo $DATA | awk -F new_line '{print $1}'
echo
echo
echo 
echo $DATA | awk -F new_line '{print $2}'

Good luck
 

Attachments

  • shot.png
    shot.png
    49.5 KB · Views: 138
Last edited:
Status
Not open for further replies.
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.