Jump to content
untidey

Multi-stage Keyboard Shortcuts

Recommended Posts

I would love to see Alfred learn about multi-stage keyboard shortcuts as seen in text editors like Sublime Text 2 and some keyboard shortcut utilities. Standard chordal shortcuts get heavily overloaded and difficult to remember fast. Multi-stage shortcuts allow you to define shortcuts as a series of discrete keypresses and overload them like so:

 

Command-k, m (Press 'Command-k', release, press 'm')

Command-k, n (Press 'Command-k', release, press 'n')

Command-k, s, a (Press 'Command-k', release, press 's', release, press 'a') [Just as an example]

 

Shortcuts like this are much easier to remember than increasingly arcane chordal shortcuts. To overload 'Command-k' using chordal shortcuts you have to do this:

 

Command-k

Command-Option-k

Command-Control-k

Command-Control-Option-Shift-k

etc

Share this post


Link to post
Share on other sites

You could make a shortcut "command + k" that opens a Script Filter where all items have one or two character keywords. You need to press enter to execute the shortcut, but you get the benefit of listing all available shortcut starting with "command + k". make any sense?

Share this post


Link to post
Share on other sites

Yup that makes sense.  I'm actually prefixing all of my workflows with , (comma) so that I immediately filter down the workflows from everything else.  This also feels natural to me coming from vim (leader key).

Share this post


Link to post
Share on other sites
You could make a shortcut "command + k" that opens a Script Filter where all items have one or two character keywords. You need to press enter to execute the shortcut, but you get the benefit of listing all available shortcut starting with "command + k". make any sense?

 

I'll give it a shot and see how it works out. Thanks for the suggestion.

Share this post


Link to post
Share on other sites

Hi everyone! I thought I would write this down here to give some ideas to some of you... Using the new "Snippet" object, it is now possible to have some kind of a workaround for multi-stage shortcuts. I said workaround, since you need to be aware that the keypress would be sent to the front application. Therefore, you need to be careful with which key you use. To make it more like command keys, I'm using the "alt" key as modifier. This is writing symbols, so you could used those symbols as the text for the Snippet action. For example, [ alt+o, alt+m ] would be [ øµ ] (on my French-Canadian Keyboard) and could be used to (for example) open the activity monitor (or run any action that you wish)

 

Here is a workflow to give you some example, but keep in mind that this is a workaround ;) 

https://nofile.io/f/FSS6iMp9fw3/Hotkey+Sequence+Trigger.alfredworkflow

 

I would put here my README that's inside the workflow to give you a better overview about the idea:

 

-------------

 

Hotkey Sequence Trigger - README

 

This is a workaround idea to have a multi-stages hotkey trigger. The idea is to use the "Snippet" object to detects the key sequence and run a defined action if there's a match.

 

* This is working very well, but has the inconvenient that every key press is sent to the front application. Therefore, make sure the snippet key sequence doesn't interfere with your application. Also, please note that Alfred will send keypress to remove the snippet text before doing the action. This is great so the entered key sequence is removed from a text editor, but this could lead to unwanted behaviour if the snippet is run from a non text field (example: in a browser window, there's good chances that Alfred would activate the shortcut to go to previous pages).

 

* To work with text, you would need to copy it first (with the help of a script if the hotkey sequence doesn't interfere with the selection or with cmd+c).

 

* To modify text in a text editor, you would need to first copy the selection and keep it selected or use cmd+x to copy and remove the text before doing the hotkey sequence so the text is replaced.

 

Note: to make it more like a sequence of key commands, I've used snippet that use special symbol using the "alt" modifier key, but this is working with any key sequence that you set in the Snippet object.

 

** Please note that the key sequence are based on a French-Canadian keyboard and may be different than what is written in the object note. So, you may be better to change them for something that better suit your keyboard.

 

-------------

 

I hope this is useful to some!

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...