textmate / css.tmbundle

TextMate support for CSS
54 stars 36 forks source link

"Insert Color..." does not work in OS X Mavericks #13

Closed gavinanderegg closed 10 years ago

gavinanderegg commented 10 years ago

In OS X Mountain Lion, selecting "CSS -> Insert Color...", or using the default shortcut of cmd-shift-c would bring up the system colour chooser. Now, when doing the same in OS X Mavericks, the TextMate window defocuses for a moment, then refocuses, but the colour chooser never appears. This happens both in CSS files (when using the menu item or the shortcut) and in other files (when using the menu item).

infininight commented 10 years ago

We had a workaround in place for this until Applescript support is added back to TextMate however the Applescript Runner application is no longer included in Mavericks. Will either need to wait until we have Applescript support back or figure out a new workaround.

Down10 commented 10 years ago

I found an ugly solution for this, which is to replace "AppleScript Runner" with "AppleScript Editor" in lines 74 and 75 of TextMate's UI support file:

          col = %x{osascript -e 'tell app "AppleScript Editor" to activate' \
                             -e 'tell app "AppleScript Editor" to choose color#{def_col}'}

Because of Mavericks' heavy-handed restrictions to scripting accessibility, you'll first need to activate AppleScript Editor.app: System Preferences > Security & Privacy pane (unlock it) > Privacy tab > Accessibility, and adding "AppleScript Editor" to the list by dragging and dropping.

This fix will open AppleScript Editor.app in the background, which will then need to be closed manually, but the functionality to the "Insert Color…" command will be restored. (It worked for me, anyway.)

Apple killed a lot of third-party AppleScript functionality with the latest OS update. I'm sure there's a smarter method, but I haven't yet discovered a way to call an AppleScript-running process from the Terminal without bringing up a visible application like Applescript Editor to the foreground.

EugeneDae commented 10 years ago

@Down10

Download this app, place anywhere you want (Desktop or next to ui.rb), then in ui.rb in that line replace "AppleScript Editor" with "AppThatDoesNothing".

Nvm, you can simply use "System Events" instead of "AppleScript Editor" or "AppleScript Runner".

Down10 commented 10 years ago

Okay, that's good. Your suggestion of installing some mysterious app set off all my "TROJAN!!!" alarms.

darrenterhune commented 10 years ago

Thanks @Down10 for that quick fix ;-)