Apple Calendar - Single Letter Google Shortcuts

I have moved to Apple Calendar from Google Calendar. The main thing I miss is the ability to switch views using "d" Day, "w" Week, etc. I know I can use Apple-n etc but the muscle memory is strong for the google shortscuts.

In my attempt to use keyboard maestro to add the google shortcuts to apple calendar, I have run into the problem that if I create a entry as soon as I press for example "w" it switches view. Here is my attempt.

As a first time user, I want you to feel welcome here asking questions. So, welcome.

I drafted a reply but I see Nige is replying at the same time as me, and his answers are always twice as good as mine, so I'll let him handle this one.

The problem is that "unmodified letter" shortcuts are an app or web app thing -- they can tell if you are in an active text-entry context and behave accordingly, Keyboard Maestro can't with total reliability.

You might be able to get away with a menu item check as a proxy for "am I in a text field?" -- the most likely in this case is whether or not "Edit" -> "Select All" is available. Give these a go and see!

Calendar Only Macros.kmmacros (13.5 KB)

Day View Example:

That's a wonderful answer. Indeed, more than twice as good as mine would have been. I concur, it will probably solve his problem.

Thank you so much for your reply and time to create this. I am still trying to understand what it does and how it does it.

It works except for one instance.

In Daily, and weekly view you can switch to D, W or M views. But when in Monthly view D and W don't work.

Nuts -- "Month" is the one view where "Select All" is an available choice in the Edit menu... Time to go searching again.

I don't use Calendar much, so you'll probably find something usable quicker than me. Want you are looking for is a menu item that is either always available when you want to be able to type the "D", "W", "M" and "Y" characters and have them interpreted as normal text, or is never available in that situation (you could even use a combination of menu items).

Looking at it, the "Edit" menu's "Start Dictation" might be a suitable candidate -- I think you can only dictate when a text field is active. Just change the "If" action's text from "Select All" to "Start Dictation" and see if that's any better.

If that does work we can look at the next step -- combining all four macros into one... That'll introduce a couple of useful concepts. Or you can leave them as individual macros if you're happier.

1 Like

Wow. That is worth investigating. You may have just solved a long-standing problem.

1 Like

Yes, as @Airy has just said, this is great. It is much more robust than the old "Select All" method to determine if the cursor is in a text field. It seems that "Edit>Start Dictation" is available in just about every App on the Mac and is only active in text fields ("Select All" is sometimes available when not in a text field).

This discovery might make using single letter hot keys in KM a lot more viable... I have always avoided single letter key hot keys before, even though potentially they are so nice to use.

Is "Edit>Start Dictation" a relatively new menu item?

I'm not so sure -- it looks like it's permanently enabled in Safari, for example. So you'll have to go app by app.

I should have said "In Calendar, I think you can only dictate when a text field is active".

1 Like

Good point. I just tried it in Keyboard Maestro and it worked for hot keys in Keyboard Maestro itself. I have β€œv” to toggle Actions or Macros enabled status and it seems to work.

Actually, in testing this doesn't seem to be the case. It is enabled if in a text field only (which is a lot of the time in Safari) but if not in a text field it is disabled like in the other Apps.

@LtGimlet If you can live with short/long press, you avoid the problem of KM not knowing which field the cursor is in. Although the menu idea is ingenious. :grinning:

In any case, if you tap β€œd”, β€œw” or whatever letter you want, briefly (normally), the letter is typed. If you hold the key a little longer, the view changes.

This is not perfect either. If some letters are typed when the key is released and others when the key is pressed, problems arise when typing quickly. But only then. And maybe you don't write that fast. :slightly_smiling_face:

OK -- I can see what's going on. If you've never enabled Dictation the menu item is always available in Safari (and maybe other apps). After you've enabled Dictation for the first time and gone through the Privacy prompts, etc the menu item will behave as you describe.

1 Like

That’s very good to know. After doing that it seems a good test of whether in a text field or not. I will keep using it and see if I can break it :grinning:

Would the Apple-1 key shortcuts work in a way that would overcome the menu problem?

I'm back a good few versions of macOS so I don't know what may have changed, but here in Mojave the Edit > Duplicate command is only enabled when there's also a text field in use.

If you changed to using ⌘1 etc to switch views -- instead of trying to use the Google Calendar shortcuts you're used to -- that would certainly solve the problem! No macros needed...

The problem isn't in the macro, it's with the way you want to trigger it. Unmodified hot key triggers can be difficult because there's no global, certain, method of determining if a text input widget is currently active.

Hot key triggers are "swallowed" by Keyboard Maestro and never reach the frontmost application. So while you can use D, W, M and Y as triggers, as soon as you try to make an event to Walk the dogs with Mandy it'll actually come out as alk the ogs ith and.

All it's doing is trying to determine if a text input area is currently active, using the presence/absence of a menu item as an indicator of such -- the start of the "If" action. There's two possible results:

  1. If it thinks you are trying to input text it types the keystroke for you -- that works because KM doesn't consider its own typing to be potential triggers.
  2. If it thinks you aren't in an input area then you must be trying to change views, so it selects the appropriate menu item

My apologies for not replying earlier and communicating my thanks to you all. Life got away from me :slight_smile:

1 Like