News for hackers. Stuff that matters.
Re:Change OSX Terminal theme on the fly when you SSH by jimwise on Thursday April 07, 2011 @12:08PM (#2419984)
Interesting bug in this example:

Since the AppleScript instructs the terminal to change _the current session_'s theme, if ssh exits while you're in another tab (say due to a disconnect), the tab which is currently frontmost will have its theme changed to 'Solarized Dark', while the tab you had run ssh in will stay as 'Solarized Light'.

Of course, this won't show up in testing -- and will be rather surprising when it does show up. :-)

Re:Change OSX Terminal theme on the fly when you SSH by tzs on Thursday April 07, 2011 @04:17PM (#2421030)
I hate Terminal's AppleScript implementation. For example, this does not work:

   tell application "Terminal"
      set my_tab to first tab of first window
      get container of my_tab
   end tell
In nearly everything else I've seen, "get container of" works.

Or consider this. It changes the settings of the first tab of the first window to the first settings set. It works great:

   tell application "Terminal"
      set current settings of first tab of first window to first settings set
   end tell
However, a trivial change that in any sane implementation would be exactly equivalent fails:

   tell application "Terminal"
      set first_set to first settings set
      set current settings of first tab of first window to first_set
   end tell
Changing it slightly makes it work:

   tell application "Terminal"
      set first_set to a reference to first settings set
      set current settings of first tab of first window to first_set
   end tell
AppleScript is the most frustrating language I've ever tried to work with because of things like this.
Re:Change OSX Terminal theme on the fly when you SSH by intinig on Thursday April 07, 2011 @03:05PM (#2420788)
You are right about the bug, I should check whether the terminal applescript interface allows changing the theme of a named session.