Saturday, February 3, 2024
HomeAppleapplescript - Customized protocol handlers in Sonoma

applescript – Customized protocol handlers in Sonoma


I would like to have the ability to insert hyperlinks into Calendar entries, such that once I click on them, then the command

/choose/homebrew/bin/emacsclient -n --eval '(org-open-link-from-string "" & tackle & "")'

is executed, the place tackle is the URL of the hyperlink.

Earlier than the replace to Sonoma, this labored tremendous, with the next Apple Script:

on open location this_URL
    set len to size of this_URL
    set prefixlen to size of "mu4e://"
    set tackle to characters (prefixlen + 1) via len of this_URL as string
    do shell script "/choose/homebrew/bin/emacsclient -n --eval '(org-open-link-from-string "" & tackle & "")'"
    inform utility "Emacs" to activate
finish open location

I’ve exported this script as an .app, after which modified the Data.plist file by including

    <key>CFBundleIdentifier</key>
    <string>com.myown.AppleScript.mu4e</string>
    <key>CFBundleURLTypes</key>
    <array>
      <dict>
        <key>CFBundleURLName</key>
        <string>mu4e</string>
        <key>CFBundleURLSchemes</key>
        <array>
          <string>mu4e</string>
        </array>
      </dict>
    </array>

after which working the appliance one, to register the app because the handler for the mu4e:// protocol.

In Sonoma, this doesn’t work anymore. After I proceed as above, then insert a hyperlink into an app corresponding to Calendar, after which click on it, then my app is run (it reveals very briefly within the dock, then disappears), however nothing else occurs.

It could be that my app is prevented from working emacsclient through the the shell script. However I don’t get any error message, or a pop up asking whether or not my app is ready to management emacsclient.

Thanks very a lot prematurely for any recommendation on enabling customized protocol handlers in Sonoma!



Supply hyperlink

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments