Jump to content

Is it possible to program hotkeys for file actions (instead of the default command+1-9)?

Recommended Posts

I think what you would want is simply a workflow with a "HotKey" trigger that pass the selection to an "Open File" set to open in VSCode. This has the advantage to work with the selection from inside Alfred as well as directly inside Finder


Here is an example workflow, simply set the HotKey trigger to your preferred hotkey: https://d.pr/f/0tug1h

Edited by GuiB
Link to comment
8 hours ago, PaperCloud10 said:

but it doesn't when I bring up the file actions menu

That's why I said "I think what you would want" since this bypass the file action menu and would them be faster to action. Also, by working "with the selection from inside Alfred" I meant from a standard Search, File Search or File Browser from inside Alfred since the selection would be passing the file path to the workflow trigger. However, this is not working from inside the File Action Menu.


If you don't like to have it directly accessible and would prefer to only have a shortcut from inside a File Action, then it's not possible at the moment. If you read the "Alfred 4.5 Beta: Take a first look at Universal Actions" thread (which is a new feature that works like the File Action, but now we can add actions for URLs and Texts), @Andrew mentioned here that we will be able to connect a hotkey to an action in the future. However, from my understanding this won't be to add hotkey inside the Universal Action panel, but to access a defined action globally from a HotKey trigger. So, this would be basically the same as the workflow I posted.


The only way I see to make it work for your use case at the moment would be to set a hotkey that would automatically type the title or your wanted action and activate it, but the problem here is that the workflow trigger would work in any Alfred's text field, so you could accidentally trig it from anywhere in Alfred and not just specifically at the File Action panel.


Another way I can think that may make it work a little more closely to what you want would be to make use of the new Universal Action and which we can now directly access the actions that contains a second panel view (ex: "Open with..."). However, this will also be accessible as a global hotkey, so not inside the File Action panel, but this will pop a list of applications that can open your file and VSCode could be at the top (not guaranteed), so you would be able to activate it using the Alfred shortcuts (CMD+1, CMD+2...)


Here is an updated workflow with those 2 ideas added so you can test and see if something works for you: https://d.pr/f/EM3rbg

Link to comment

Hey, sorry about the late reply, my Alfred had some issues that caused me to uninstall and reinstall it. I think this method "set a hotkey that would automatically type the title or your wanted action and activate it" is the closest to what I wanted. I'll use it for now and see if there's interference. The reason why I want to remap the hotkeys is so I can completely ditch Finder and force myself to use Alfred as my file browser, but the hotkeys weren't the most optimal. Anyways, I appreciate the help!

Link to comment
On 7/22/2021 at 2:03 AM, PaperCloud10 said:

The reason why I want to remap the hotkeys is so I can completely ditch Finder and force myself to use Alfred as my file browser, but the hotkeys weren't the most optimal.


I actually also try to use Alfred as much as possible instead of Finder and for myself (and regarding your use case) I can't see what could be more optimal than having a direct shortcut to send your selected file to your editor of choice. Which is what I sent you in my first workflow example. You can put your selection inside the Alfred file browser to the file that you want to send to your favourite text editor and directly do the shortcut which will send it directly instead of needing to go inside the Actions panel.

It's up to you if you prefer going into the Actions panel, but to show you how I'm doing it, I've configured a Hotkey trigger (set to work only when Alfred has the focus and that sends the Selection in macOS) with the Hotkey set to CMD+E ("E" for Edit) that send the select item directly to my editor of choice.

Here is an updated workflow with a specific Hotkey trigger set to work the way I'm telling you (look at the first one, top left in the workflow). Set you preferred key combination (CMD+E on my side) and try it when you select a file in the Alfred File Browser.

The difference between that one and the other is that the second Hotkey (like the first workflow I sent you) would work from anywhere, so it could be useful if you want to send the selection from Finder or inside Alfred or other file browser, but by restricting it to only Alfred you can configure a simpler hotkey that won't interfere with others.

Edited by GuiB
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...