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

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?


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.


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.