In recent versions of macOS, the LaunchServices have become quite a bit smarter under the hood than they used to be. The second is "Other.", which obviously will allow you to select an application not in the list with a caveat.By default this application should be located in the Resources folder inside the prefpane bundle SwiftDefaultApps will, however, also look for it in the directory it is itself located in (for the CLI version) and every Applicationsfolder in the computer. Its only function is being able to open any URI Scheme or UTI whatsoever, printing a line to the console (specifying whatever it was that launched it) and immediately quitting. One of them is "Do Nothing", what this does is register the item to be handled by a dummy application which basically does nothing.This data is generated by LaunchServices itself. Selecting any URI Scheme or File type (always represented by a UTI), will give you a list of all valid applications for each LaunchServices role.The user-interface should be pretty self-explanatory but, there are some things that might require an explanation: This Preference pane will let you view and change default application associations for basically any URI Scheme and/or filetype in macOS. ` ` `shell # If, when you installed the Preferences Pane, you only installed it for the current user, # replace /Library with ~/Library in the two commands below # Remove quanrantine flag xattr -r -d /Library/PreferencePanes/SwiftDefaultApps.prefPane/Contents/Resources/ThisAppDoesNothing.app # Open the app open /Library/PreferencePanes/SwiftDefaultApps.prefPane/Contents/Resources/ThisAppDoesNothing.appĪfter these 2 steps, the Do Nothing app should work when you pick it up. For this, open a terminal and run the 2 following commands: :warning: The **Do Nothing ** dummy app needs to be launched before to use it in the pref pane. It will open the system preferences and you find the app on the bottom of the icons. In that file you I keep track of all my app preferences and reproduce them immediately after a complete fresh install or when getting an account on other Mac just running: duti ~/.default-apps.` ` then use Spotlight to open the `SwiftDefaultApps.prefpane `. Notice that I can associate a URL handler like txmt and also file types like Ruby scripts. Now make a text file somewhere in your system where you associate bundle ids with UTI: # ~/.default-apps.duti Mdls -name kMDItemContentTypeTree /Applications/MacVim.app Second the UTI of the file type, Apple provides a list, but you can also explore the supported UTI by your app like this: Mdls -name kMDItemCFBundleIdentifier /Applications/MacVim.app First bundle ids of the Apps you want to associate: You could invoke it by entering speak://say-something-funny into your browser or by using the open command on the command line: $ open "speak://hello-from-the-command-line"Īs of today, the best way I found to solve this problem on a Mac with the least overhead is using the command line duti which allows me to define in a very simple text file all my associations: # The 'say' command on macOS will speak the provided text through the speaker Everything after the scheme and forward slashes will be passed as the argument to your script.įor example, you could use the following bash script as a handler for the "speak://" protocol. Just provide your script, enter your desired scheme name on the advanced settings page and then click to build the app (it's all automated). The URL is then passed to the script as an argument. If your app is the default handler for a URI scheme, it will launch open every time a URL matching the scheme is opened. These can be either standard URI schemes such as http or a custom URI schemes of your choice (e.g. Register as URI scheme handler makes the app register as a handler for URI schemes. Although it's really just a script wrapper, it does enable some cool things like dialog boxes and menu bar items.Ĭritically, it even enables you to register your "app" as a handler for your own custom URL scheme. Platypus is an open source tool that allows you to create standalone "Applications" from a shell script or other scripting language. This question is a decade old(!) but a Google search brought me here so I wanted to mention something I just discovered.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |