Jump to content

Possible to use chords/two-stroke shortcuts?

Recommended Posts

I'd like to have a workflow that uses a compound (two-stroke) shortcut.


Example: press Option-Ctrl-A to silently activate the start of my workflow. The next keypress will then trigger an action depending on what it is. The exact usecase is for switching apps where I'd rather not have a separate hotkeys for each app, but instead a single one to activate the mode and then type "T" for Terminal, "V" for Vim, etc. etc.. If no valid second stroke was entered the flow could simply not activate.


I know I could do this with the typical command {query} syntax, but Is it possible to do this as a true hotkey shortcut, without popping up the Alfred window, taking text input, and then hitting enter to submit it?

Link to comment
No, this is not possible in a sensible (read: easy and supported) way. You might do it with some trickery.


You may try a shortcut that will trigger a Script Filter Alfred call where you’ll input your key. Since Script Filters run code on key presses, you might make it execute what you need and dismiss Alfred’s window. The result will be close to what you want: type a shortcut and then a single key for your action. Though it will show Alfred’s window, it will be quickly dismissed and you won’t have to ↩.


It will require a bit of coding, and it won’t look pretty. In fact, it should look very hacky, but it has the potential to work.

Link to comment

Thanks for the reply! I had figured it wasn't doable without a bit of hackery; I'll tinker around with `Script Filter` a bit.


I do think this would be a pretty cool feature for Alfred to add. It could be a sort of "silent" shortcut that when activated listens for the next keystroke and then responds accordingly. If that keystroke doesn't match an instruction in its list of cases, or if a timeout elapses with no keypress, it just noops.

Link to comment
I do think this would be a pretty cool feature for Alfred to add.


I disagree. And I’m a vim user that is constantly disappointed by the weak vim emulation of other editors (fingers crossed for NeoVim to fix that). I like vims behaviour so much, I sometimes even miss it in doing regular OS tasks.

Even so, Alfred’s team is small (hence when focus is spent on one feature, all the others get sent back considerably) and this is a feature that would not only appeal to few, it would be somewhat obtuse and orthogonal to Alfred’s established conventions.

This sounds like a feature for an external dedicated tool. One that could invoke Alfred Workflows via AppleScript, but not one for Alfred itself.

Edited by Vítor
Link to comment
  • 5 years later...

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...