I want to select a file and press a key combo to open the selected file with a specific application that's installed on my mac running Catalina. I don't want to always open this file type with this program so I can't create default settings.
Is there any way to map keyboard shortcut like the above? Please advise. Thanks!
Best Answer
I have seen similar mappings done in Karabiner - a more flexible system for mapping keys. It allows even funny mappings - like on the right shift key, or functions that happen if you hold a key. But they require some scripting and while it's easy to get something that works on my machine only its hard to figure out something sharable. I will outline what I think needs to be done.
Karabiner a feature called "Complex modifications" that allows this. I find the documentation sparse but it's simple enough to figure out.
There is a number of pre-made mappings where the code can be inspected at comples_modifications (use the "show JSON" that reveals when you click the triangle next to "import").
Custom mappings can be just put under
~/.config/karabiner/assets/complex_modifications
and can then be imported.The launch app mappings all have a line like this:
All that's missing is the selected file.
oh-my-zsh has a function that does this. It's rather short, here in full:
From the command line a command like this works:
All that would be left is to figure out how to get the pfs definition into Karabiner... I will leave that as exercise to the interested reader ?