top of page
Search

How everybody should write keyboard shortcuts (⇧ + ⌘ + 🏆)

I’ve been putting a few things together in the background for this blog and this has led me down the path of writing out a lot of keyboard shortcuts (“Shift + Command + L” etc.). Normally this is fine but after writing out so many it soon becomes repetitive and boring. I also prefer to write out shortcuts with symbols instead of text like “⇧ + ⌘ + L”. This only adds to repetition, bordom and RSI from all the copy and pasting.


The Solution

The solution then was to write myself a Keyboard Maestro shortcut that does most of the work for me - See below:

Keyboard Maestro shortcut in action

Triggered by a Hot Key, the macro opens a dialogue window where I can select the modifier key(s) and then enter the letter(s) or number(s) to drive the shortcut.


It is very simple but each checkbox relates to a specific modifier key and its corrosponding symbol, there is also a dictionary that links words like ‘Backspace’, ‘Escape’ & ’Return’ to their symbols. Hit enter and that whole lot gets pasted into your text editor.


This is a bit of a long post but most of it is breaking down the macro and how it works. If you can't be bothered with that then you can just download it here - Keyboard Shortcut Macro


How?

I will caveat this whole post with the statement "I don’t really know what I am doing. My motto is if it works, all is good." I am sure some users will be wondering why on earth I went about this as I have.

Create the Dictionary

First up we create a dictionary of all the text elements we want to replace with symbols. It is very simple - you'll have a word like “backspace” which you want to replace with a symbol “⌫” so all you do is simply write out “backspace” : “⌫”, all within the curly brackets. Rinse and repeat for any other words you would like to replace.

Create the Dictionary

Note: You don’t have to replace a word with symbols it could be another word or a number. I also replace any spaces with a "+".


Pop-Up Dialog Box

This is the dialogue box the user will interact with. It is a list of variables and values. The first 4 (Shift, Control, Option & Command) are checkboxes which you can see by the variable value of “0|1” (this is Keyboard Maestro's way of defining a checkbox).


The final variable “Key” is left blank for the user to enter their desired shortcut key.

Pop-Up Dialog Box

Note: clicking the arrow in the red circle will show you all the other types of variables you can create.


Create Variable

When creating the shortcut with the symbols we need somewhere to store it and this is done by creating a blank variable called “KBSHORTCUT”

Create Variable

Modifier Key "If’s"

We ask the user which modifier keys will be used for the shortcut and get them to check the corresponding boxes in the pop-up dialogue window. To avoid creating symbols for every modifier option we need to check if the user has checked the box.


Using the “If” action we define the variable to check, here it is the variable “Shift” and see if the checkbox has been selected “1|1” (”0|1” is not checked - “1|1” is checked)

If true, we add the desired symbol (”⇧ + ”) to the variable we created earlier.

Modifier Key "If’s"

Note: This step is then repeated for the remaining modifier keys - Control, Option & Command


Shortcut "If’s"

As above, we need to check if the user’s input for the variable "key" has a replacement in the dictionary e.g. “backspace”, “escape” etc. If not then we use the users input.


Using an if statement, we check to make sure some text has been entered into the “Key” variable and then run a “For Each” action. What this means, is for each line item (“backspace” : “⌫”) in the dictionary we run a "Search and Replace" action to find our dictionary text (“backspace”) and replace it with our symbol (“⌫”).


Our modified entry then gets added to our “KBSHORTCUT” Variable.

Shortcut "If’s"

Note: A little bit of coding knowledge doesn’t go amiss here but you shouldn’t have to change it so don’t worry if you don’t.


Embellish and Paste

Finally, we take our new shortcut which is stored in our “KBSHORCTUT” variable and capitalise it. Keyboard Maestro then pastes this into our text editor.

Embellish and Paste

⌥ + ⌘ + DONE

I think there is still room for improvement but it is a good start and it has solved a problem that I was having, so this can only be a good thing.


Let me know your thoughts and if you have any improvements or suggestions please leave a comment. No one has left any yet so I'd be so happy to see one 😊


Personal Note

Please do like and share if you feel the content was worthy. I am trying extra hard to get more traffic through to the site and every little helps.


P.S - I am working on a whole set of tips and tricks for Mac which I will make available to all subscribers. Be sure to subscribe if you want to get a copy of that.




818 views0 comments

Recent Posts

See All

Commenti


Subscribe and never miss a post

Thanks for subscribing!

bottom of page