8

I have some unicode characters that I like to use. In most programs there is a keyboard shortcut Command+Control+Space to show this window. But then if hit Command-W, I will close the app's main window or tab, not this floating popup. To close the popup, I have to hunt for the little close button in the top left. It annoys me. Is there another keyboard shortcut that can close that window, or any floating window like that?

5
  • While in compact mode there are no such problems. You can easily select symbols from 'Frequently used' and/or 'Favorites' using arrow keys and also search by name (there are 18 results for 'grinning face' :-)). Nov 10, 2021 at 13:49
  • @AivarPaalberg so in compact mode, the viewer closes itself after having (possibly accidentally) popped up when hitting Ctrl-Cmd-Space? Mar 11 at 12:13
  • @ErikKaplun There is ESC for that. Mar 11 at 12:32
  • @AivarPaalberg the window is not active by default, so if you accidentally pressed ⌃⌘␣, ESC won't do anything. Mar 13 at 11:40
  • @ErikKaplun - there is different behavior depending whether cursor is active (text insertion) or not. In case of former ESC works. In latter case it pops up window which is not active. For that scenario zentrope provided solution Mar 14 at 9:35

4 Answers 4

2

That is a good point (you can make at apple.com/feedback).

I tried several things and what I noticed is that it matters if the Character Viewer window is active. In your example pic, you can tell it is not active because the window management buttons are grey instead of red, grey, and green (the middle, normally yellow, button is not available because there is no full screen mode for dialogs).

Here's the rub: sometimes I could not make the dialog active in the Notes app but I could consistently with Safari. 🤨. In either case, selecting a character to insert did not make the window active. When I could make it active, it required two clicks (either a double click; or click, pause, click) on the title or tool bar. Then, ⌘W worked. However, I could have just clicked once on the close button and be done with it.


If you decide to submit this feedback to Apple, as I will do, I suggest to you that you suggest to them: Make the Character Viewer dialog a full-fledged app:

  • Free-standing (currently, if you open the dialog with one app active, it won't be available to another app unless the dialog is invoked again with the second app active)
  • Adhere to all the app-level rules (such as following normal commands from menus or keyboard shortcuts including quitting, closing, and the App Switcher)
  • Adds the chosen character to the clipboard rather than inserting into the app active when the dialog was invoked so the user can paste into whatever document or text box the user wishes, even multiple times.
  • Not always stay on top, frequently obscuring content forcing users to move it around, slowing productivity

OR, make the dialog a pane instead so that with a keystroke or click it pulls down from the window frame and goes away when a character is inserted.

OR, whatever genius idea you have. Really, we just want someone at Apple to review the viewer and fix the UIX issues.


I use several characters often (⌘, ⌥, ⇥, ⇧, ↵, etc.), so I created keyboard replacements for them. If you have a few you use frequently, avoid the Character Viewer entirely:

  1. Insert a character into Note or document and copy it.
  2. Go to System Preferences > Keyboard > Text.
  3. Click [+] at the bottom of the current list.
  4. Give it a unique string of characters you can remember in the first column headed by "Replace." I use ¡com – the upside down exclamation then com – for ⌘; you can get the upside down exclamation with ⌥1.
  5. Paste the copied character into the second, "With," column.

Choose whatever is easy for you to use for the leading character, but I recommend sticking with alternative characters you get with the ⌥ modifier key, especially ones easy to type and not something you use regularly. Keep it consistent. Don't be afraid to use more than a couple of defining characters. For example, ¡ plus com (⌘), opt (⌥), tab (⇥), shift (⇧), or return (↵) makes them easy to remember and type.

Thank you for posting your question. I did just tolerate the quirkiness of this dialog but you prompted me to provide my own feedback.

3
  • 1
    I have several hundred text replacements defined in System Preferences > Keyboard > Text, some of which I previously used Character Viewer for, however I still like having a keyboard shortcut to show/hide it for the ones not already assigned a text replacement. Nov 9, 2021 at 21:50
  • Thanks. I had started using shortcuts like that too a while back (with \ backslash), but them I forgot about them. I like the idea and will try that again.
    – Rob N
    Nov 11, 2021 at 0:02
  • ⌥1 is a nice idea! Mar 11 at 12:26
2

Is there a keyboard shortcut to close the Character Viewer popup window?

Technically yes, it's ⌘W, however, the window has to be active in that its buttons on the upper-left of the window are showing as red, yellow, green, which of course it isn't normally.


The workaround that I use is an AppleScript script that is triggered by a keyboard shortcut assigned to it in an application named FastScripts. I use: ⌃⌘␣     (shift+command+space)

The script requires that the [√] Show Input menu in menu bar is checked in System Preferences > Keyboard > Input Sources.

The assigned keyboard shortcut both shows and hides the Character Viewer.

In Script Editor, copy and paste the example AppleScript code into a new document and save it as e.g. Toggle Character Viewer in ~/Library/Scripts/.

Example AppleScript code:

try
    ignoring application responses
        tell application "System Events" to ¬
            click menu bar item 1 of menu bar 2 of ¬
                application process "TextInputMenuAgent"
    end ignoring
    
    delay 0.1
    do shell script "killall 'System Events'"
    
    tell application "System Events"
        launch
        click menu item 1 of menu 1 of ¬
            menu bar item 1 of menu bar 2 of ¬
            application process "TextInputMenuAgent"
    end tell
end try

Notes:

The example AppleScript code, shown above, was tested in Script Editor and triggered by FastScripts under macOS Catalina and with Language & Region settings in System Preferences set to English (US) — Primary and worked for me without issue1.

  • 1 Assumes necessary and appropriate settings in System Preferences > Security & Privacy > Privacy have been set/addressed as needed.

In the example AppleScript code, menu 1 in click menu item 1 of menu 1 of ¬ is either Show Emoji & Symbols or Hide Emoji & Symbols on the actual menu, depending on the state of the Character Viewer window. If one also has Input Sources showing on the Input menu then adjust the number of the menu item accordingly and note that menu separators count in the number count.

The example AppleScript code can be used in other applications that have similar capability to run a script and assign a keyboard shortcut. Hammerspoon is another application that I use for similar things.

While I do not use Keyboard Maestro or Karabiner-Elements, I believe they too can run a script with an assigned keyboard shortcut.

FastScripts can be used to configure up to 10 script shortcuts for free. To enable unlimited script shortcuts, purchase a license and enter your license info in the Registration pane.

I am not affiliated with the developer of FastScripts or Hammerspoon, just a satisfied user of the products.

4
  • The Character Viewer has also to be in the expanded mode for Command + W to work. The shortcut does not work if the Character Viewer is in the compact mode, no matter what. You can also simply press ESC to close the Character Viewer if it is in the expanded mode and the window management icons are activated.
    – Alper
    Nov 9, 2021 at 21:46
  • @Alper, Yes I'm aware of what you said, although, the picture in the OP is of the expanded view and is the only reason I include the statement I did in my answer, however as the normal state of that window is inactive unless explicitly activated as far as any keyboard shortcut is concerned it's more of a moot point than anything. The primary purpose of my answer is to share the workaround I use. Nov 9, 2021 at 22:02
  • Thanks, I'd been meaning to try Karabiner, but never got to it. I had some bad experience with kernel extensions years ago, but Karabiner probably doesn't even work that way these days (if it ever did).
    – Rob N
    Nov 11, 2021 at 0:05
  • FastScripts free version doesn't allow use of kb shortcuts to activate scripts. Mar 13 at 11:41
1

If you click the button to the right of the search box, the window becomes a popup that you can dismiss by hitting Esc.

11
  • Thx for your contribution but I already mentioned that in a comment to @user3439894's answer below.
    – Alper
    Nov 10, 2021 at 15:25
  • @Alper Sorry, I hadn't seen that.
    – dee.ogo
    Nov 10, 2021 at 15:37
  • 1
    There is nothing wrong with posting answers repeating things mentioned in a comment.
    – nohillside
    Nov 10, 2021 at 15:51
  • Nice. When I pop it up a second time (after changing to that mode), it's a popover right next to my text entry point, and it disappears once I insert the character.
    – Rob N
    Nov 10, 2021 at 23:59
  • 1
    @nohillside I then agree to disagree. Some may think it should not be required but I will be mentioning a comment prior to mine, even if I had not noticed it at first, should something similar happen and the places are switched.
    – Alper
    Jan 13 at 12:26
1

Yes, this is absolutely doable.

System Preferences → Keyboard → Keyboard Tab

There's an option to "Press the fn key to:" and then a drop down which defaults to "Do Nothing".

Change that drop down to "Show Emoji & Symbols". After that, tapping fn toggles the character viewer. Tap once to bring up the viewer, tap again to dismiss it. Works for the compact or full window.

This doesn't interfere with pressing and holding fn to invoke F1, F2, etc.

Newer Magic Keyboards have aglobe 🌐/fn key on them which defaults to doing the same thing.

If you hit CtrlCmdSpace to bring up the viewer, tapping fn (with the proper setting) will dismiss it.

FWIW, I hooked up a Keychron mechanical keyboard to a 2015 MacBook Pro running Monterey and tapping fn2 on that thing worked as well.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .