[phpBB Debug] PHP Notice: in file /viewtopic.php on line 981: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Berlin' for 'CEST/2.0/DST' instead
[phpBB Debug] PHP Notice: in file /viewtopic.php on line 981: getdate(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Berlin' for 'CEST/2.0/DST' instead
Tynsoe Projects • View topic - Scripting Enable/Disable GeekTool

Scripting Enable/Disable GeekTool

Scripting Enable/Disable GeekTool

Postby robosushi » Fri Aug 20, 2010 8:21 pm

Hey, I often have the need to enable/disable GeekTool (not individual groups, but the whole thing), and it gets tiring to repeatedly go into the System Preferences and check/uncheck the Enable box. So, I wrote the AppleScript that's copied below, and it does the trick, but I'd like something a bit more elegant...

Code: Select all
tell application "System Preferences"
   activate
   delay 0.1
   tell application "System Events" to set visible of process "System Preferences" to false
   set current pane to pane "GeekTool"
   tell application "System Events"
      tell process "System Preferences"
         click checkbox "Enable" of window "GeekTool 3"
      end tell
   end tell
   delay 1
   quit
end tell


So, it has to open up System Preferences, navigate to the pane, and click on the checkbox, which is a pretty lame solution. I would much rather be able to toggle a default (say, using the "defaults" shell command). I tried looking into that, but I couldn't find a preference that corresponded to the Enable checkbox. So, how exactly would I go about this? Would killing/restarting the process have the equivalent effect of toggling the checkbox? Thanks for any help!
robosushi
 
Posts: 2
Joined: Fri Aug 20, 2010 8:13 pm

Re: Scripting Enable/Disable GeekTool

Postby ybizeul » Tue Aug 24, 2010 9:25 pm

Don't bother going into System Preferences

Just kill GeekTool process, or launch GeekTool.app that you will find into GeekTool.prefPane bundle.

Let me know if you need specifics
ybizeul
Site Admin
 
Posts: 133
Joined: Fri Jan 22, 2010 4:34 pm

Re: Scripting Enable/Disable GeekTool

Postby robosushi » Wed Aug 25, 2010 6:47 pm

Awesome, that works! Thanks so much. Just so other people can use it if they want to, I've got this terminal script written:

Code: Select all
#!bin/sh

geektool_status=`ps -amcwwwxo command | grep "GeekTool"`

if [ -z $geektool_status ]
  then
    open /path/to/GeekTool.app
  else
    killall GeekTool
fi


Then I make it executable, run it with "sh /name/of/script" and tack that to a hotkey with QuicKeys. Hope this helps someone else too! It works really fast now.
robosushi
 
Posts: 2
Joined: Fri Aug 20, 2010 8:13 pm

Re: Scripting Enable/Disable GeekTool

Postby Monkey » Mon Jan 10, 2011 10:55 am

Sorry to "hijack" you topic, but is there a way to adapt this script to change groups ? I've 2 groups : Group A and Group B and I'd like a script enable A (disable B); enable B (disable A) and enable AB.

TIA,

M
Monkey
 
Posts: 3
Joined: Sun Jan 09, 2011 9:53 pm

Re: Scripting Enable/Disable GeekTool

Postby ybizeul » Fri Apr 08, 2011 6:59 am

Monkey wrote:Sorry to "hijack" you topic, but is there a way to adapt this script to change groups ? I've 2 groups : Group A and Group B and I'd like a script enable A (disable B); enable B (disable A) and enable AB.

There is an Applescript guide that will help you with that : http://geektool3.tynsoe.org/documents/1
ybizeul
Site Admin
 
Posts: 133
Joined: Fri Jan 22, 2010 4:34 pm


Return to GeekTool

Who is online

Users browsing this forum: No registered users and 6 guests

cron