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 Answers
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.
-
Not sure why, but it's spelled out in the documentation that QMK can't add [fn] so my Ergodox lacks that key. I keep my Apple wired keyboard on the desk, as well, so I followed your suggestion to test: works for both the larger and compact viewer.– D. GerenCommented Mar 24, 2023 at 21:19
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.
-
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.– AlperCommented 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. Commented 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 NCommented Nov 11, 2021 at 0:05
-
FastScripts free version doesn't allow use of kb shortcuts to activate scripts. Commented Mar 13, 2022 at 11:41
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:
- Insert a character into Note or document and copy it.
- Go to System Preferences > Keyboard > Text.
- Click [+] at the bottom of the current list.
- 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.
- 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.
-
1I 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. Commented 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 NCommented Nov 11, 2021 at 0:02
-
If you click the button to the right of the search box, the window becomes a popup that you can dismiss by hitting Esc.
-
Thx for your contribution but I already mentioned that in a comment to @user3439894's answer below.– AlperCommented Nov 10, 2021 at 15:25
-
-
1There is nothing wrong with posting answers repeating things mentioned in a comment.– nohillside ♦Commented 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 NCommented 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.– AlperCommented Jan 13, 2022 at 12:26
As of 2023-11-06, under macOS 12.7.1 on a MacBook Pro using an external Apple keyboard, I can open it with the expected Ctrl+Cmd+Space, and (much to my surprise) close it with Shift+Ctrl+Cmd+Space. Adding Shift to the keyboard shortcut that opens it closes it, at least for me, on my computer, at this moment in time.
It's macOS, so it will definitely be different on earlier or later revisions.
-
Just realized, I've been using ⌘⌃⎵ to open AND close the floating pane version, without thinking about it. Not sure when that started, but my version as I write this is macOS 14.5. Plus, I see at least one comment above mentioning the same thing from 2022.– D. GerenCommented Aug 30 at 20:12
Ctrl-Cmd-Space
?