MACRO: The Glypher - Easily enter key glyphs (⇧⌘⌃⌥⏎⇥)

I use the macOS modifier key glyphs (⇧⌘⌃⌥) quite often, along with some others (← → ↓ ↑ ⏎ ⇥ ) not quite as often. Most times, I just insert the character glyph directly, but when working on web pages, I need to use the HTML encoding (⌘ = ⌘).

Over the years, I've tried many different ways to make this as easy as possible, but I didn't really like any of the methods I either wrote or tried. I don't like using my mouse while writing, so I wanted a keyboard-centric solution that allowed for multiple character insertion, and inserting either the character or its HTML code.

That all led me to write The Glypher, which I actually do like and find very easy to use. It uses an onscreen palette with easily-memorized shortcut keys:

The letters S, C, K, etc insert the associated character (or its code), or I can press the arrow keys to insert their glyphs/codes. Pressing M toggles between character and HTML output, making it easy to switch on the fly. When I'm done inserting glyphs, a single tap of the Control key dismisses the palette.

Here's how it looks in action:

An animated GIF resides within

glypher

And here's the macro:

The Glypher.kmmacros (690.9 KB)

The main macro has two triggers, ⌃` and ⇧⌃`. If invoked with the Shift key down, then the HTML palette appears (I don't use this one as often, so it's the more-complicated hot key). Without the Shift key, then the normal character palette appears. Regardless of which was invoked, though, the M key toggles between the two modes.

The only possible downside to my solution is that you can't type the defined characters as regular characters while the palette is onscreen. I'm fine with that limitation, as I just want to insert my glyphs quickly, then get back to regular typing.

The Glypher consists of three separate macro groups: The main macro activates the chosen palette, waits to see the Control key pressed, then deactivates the palettes. The two separate palette macros handle the character and HTML code insertion. (These could have been in one palette macro with different shortcut keys, but I don't intermingle the formats and wanted a simple easy-to-memorize set of shortcuts. Using two palettes accomplishes that.)

So why isn't the Apple logo on the "A" key?

Because it totally breaks the macro!

You might wonder why the Apple logo is on "F" for fruit and not "A" for Apple. I originally wrote this using "A," as it made the most logical sense. But if I set it to use "A," then the macro would only insert the  symbol regardless of which key I pressed. If I changed "A" to anything else, all the characters worked fine.

I couldn't figure out the problem, so I asked @peternlewis. The answer was interesting, and generally good to know: When Keyboard Maestro types a glyph, it does so by using the Unicode value for that glyph. But in order to actually type the Unicode to the OS, Keyboard Maestro has to send a keystroke to the OS. And "A" was the letter chosen to do that job. Normally, this isn't a problem because nobody would use a single-key shortcut of any normal character, as you couldn't then type that character. But on my palette, that's exactly what I needed to do.

So with the Apple logo trigger set to "A," when I try to insert some other character, Keyboard Maestro sends "A," which happens to be defined to insert the Apple logo, so that's what happens. If "A" isn't assigned, then the Unicode associated with the letter I typed is properly sent.

Long story short: If you're using Keyboard Maestro to output Unicode characters via single-key typed shortcuts, don't assign any of those shortcuts to A :).

Feel free to change the shortcuts, add more glyphs, etc. Just don't assign any of them to use the "A" key (see above for why that breaks the macro). Please let me know if you have any questions.

-rob.

14 Likes

That's really useful, Rob - thanks!

The only change I've made is to place the palettes under the mouse when invoked as they were persistently appearing on my second screen! 

1 Like

I had it that way at first, but found them in the way of my typing too often. The nice part about the palettes is that they remember where you drag them, so I have them both open in the same spot on my screen.

1 Like

I learned a few things from looking it over. Very nice. Thank you!

Thanks for sharing, @griffman. I like the way you've included a method to insert the symbols with the keyboard.


On the topic of palettes, here's an additional approach that you or others might consider...

I've found it convenient to create a hierarchy of palettes. My master palette is triggered using Hyper+a.

The master palette includes some frequently used macros and a few entries that open specialized palettes (all triggered using a single character).

One such palette is my symbol palette (triggered with s). It's a monster, but since it's opened using the versatile Show Palette of Macros action, it can include a custom layout and format.

Symbol Palette


Download: Show Palette of Symbols.zip (25.7 KB)


7 Likes

I use those in a few places, but I use this one often enough that I want it the fewest keystrokes away from activation as possible. Most of the rest of my not-often-used macros are on a palette, and some of them trigger other palettes—the brain was getting too full of keyboard shortcuts :).

-rob.

1 Like

Loving this macro recently, thanks again @griffman

3 Likes

Great stuff man,
The only add I made was to set the clipboard to the chosen Glyph.
Thanks for such excellent help on the forum!
Cheeers

3 Likes

I installed and enabled Glypher, but when I press Ctrl + backtick, nothing happens. I’m using KM 11.0.4 with macOS 26.


When I invoke Glypher, this is the pallet I get with redundant entries.

Also, when I type, for example, ”C”, the macro brings up another small pallet with 3 entries for the Cmd character. To paste the Cmd character I have to leave the keyboard and click one of the 3 items in the small pallet to get it to paste into a document. Other characters, when I click on them, insert directly into a focussed document, but only using my keypad.

Never mind. I somehow got 3 macros for the same character in the Char and HTML groups. Probably from multiple updates. Anyway, my bad. I deleted the redundant ones and now everything seems to working as advertised. Thanks for sharing with us.

1 Like

Glad you got it working! (Very glad, as I had no idea how to troubleshoot :)).

-rob.

I tried to expand the list of glyphs. I added the globe character, but it doesn’t seem to work when I type G. Any tips about expanding the number of glyphs?

Have you tried enabling the macro? You need a tick in the "Triggered by..." box.

(IIRC, "The Glypher" handles availability at the Macro Group level.)

Sorry, the screenshot I sent you was of a disabled Global :globe_with_meridians: macro. I enabled it in both the Chars and HTML macro groups. I notice it works in TextEdit and BBEdit, but does not work in Pages or CotEditor. All the other characters in your Glypher macro work in all these apps. A bit strange.

Found a solution for getting a Globe character to work. Insert by pasting works, whereas lnsert by typing does not.

Odd; I have no idea why you can't insert that character with typing—maybe @peternlewis knows?

-rob.

Inserting by typing can generally only type characters that can be typed. More or less.

Since it does work with some apps but not others, it seems more like an application or font issue than a KM/macOS one.

And very difficult for anyone else to help with unless you post the macro!

Good catch. Must be something about that Unicode that apps don't like typing? The "globe with meridians" is U+1F310, and the Option key, for instance, is U+2325. I was curious, so I asked an AI what might be going on. Its answer seems plausible, but I'm not enough of a technical expert to prove or disprove it; here's what it said:

The Globe with Meridians (:globe_with_meridians:, U+1F310) is an emoji character that falls outside the Basic Multilingual Plane (BMP) of Unicode. It requires UTF-16 surrogate pairs to represent, unlike the simpler modifier key symbols you're using (⌃⌘⌥↑←→↓), which are in the BMP.

It then goes on to say that those apps may not properly handle surrogate pairs, may have stricter text validation input, or may use different text rendering engines for pasted text versus typed text.

-rob.