glyf ([personal profile] glyf) wrote in [personal profile] mjg59 2014-05-19 03:47 am (UTC)

tweaks

It's worth noting that in many significant ways, Linux is not, practically speaking, more tweakable. Have you ever mapped out the sequence of steps it would take to go from "I'm using OpenOffice and I'd like to turn this button blue" to actually doing so?

Despite being somewhat neglected in the gold-rush of mobile everything, the automation tools on OS X, by contrast, are phenomenal.

Here's a practical example. On Linux, if I want to ask Chrome to tell me what URL is displayed in the current window... I'm not even sure what I can do. I guess there might be some kind of IPC I could do to, like, an extension or something? I could write a bunch of JavaScript? I mean, I'm not just saying this off the cuff - I spent about a week trying to figure it out at one point. The only thing I really learned was that if I were able to make it happen, absolutely nothing about that learning process would translate to getting the URL out of Firefox or Konqueror.

By contrast, if I want to do that on the Mac, I just pop open a Python (or Ruby, or AppleScript, or ObjC) and do this:

>>> from ScriptingBridge import SBApplication
>>> SBApplication.applicationWithBundleIdentifier_("com.google.chrome")
<GoogleChromeApplication @0x7feaddf58b10: application "Google Chrome" (303)>
>>> chrome = _
>>> windows = chrome.windows()
>>> list(windows)
[<GoogleChromeWindow @0x7feadd996b30: GoogleChromeWindow 0 of application "Googl
e Chrome" (303)>]
>>> windows[0]
<GoogleChromeWindow @0x7feadddeecd0: GoogleChromeWindow 0 of application "Google
Chrome" (303)>
>>> win = windows[0]
>>> tab = win.tabs()[0]
>>> tab.URL()
u'http://mjg59.dreamwidth.org/31714.html?mode=reply'
>>>

This was a literal interactive session that I did as I was writing this reply to prove the point. A couple of experimental tracebacks are elided, but otherwise this is actually what I did, and it took under a minute.

With BPython or IPython I get interactive tab-completion of the relevant method names. With AppleScript Editor, I can get nice HTML documentation of the various scripting objects present in applications.

I am rooting for the Linux desktop, I really am. But while Linux gives me the legal right to modify my environment in arbitrary ways, OS X gives me the practical agency to do so in useful ways.

Post a comment in response:

If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

If you are unable to use this captcha for any reason, please contact us by email at support@dreamwidth.org