Remap Keys For Mac

Posted on  by 



The best way to put these unused fn keys on Mac into use is to remap them. Remapping keys lets you assign custom functions to the keys. These keys will then perform the actions that you assign to them on your Mac. Disable The Default Function Keys Behavior. Before you assign any custom actions to your keys, the first thing you’ll want to do. Just got my kinesis advantage 2 and been unable to figure out how to get the function keys to behave similarly to a standard mac keyboard. I did manage to remap the media and volume keys using their SmartSet app (horrible install process btw.), but couldn't find a standard way to assign the macOS specific functionalities (e.g.

When Apple designed the MacBook keyboards, they were probably thinking of which commands we will be using the most when they assigned shortcuts to specific functions, but as with everything else that is being used by millions of people, actual usage does not always align with intended purpose, so many default keys are left unused while some missing keys remain desired. If you have a lot of unused keyboard shortcuts yourself and would like to replace their functions with something that you actually use, below is a guide on how to remap keys on your Mac.

The best solution I found was the free KeyRemap4MacBook utility- it lets you change the keyboard in many ways.My personal modifications (for the MacBook Air 2012 model): 'fn + cursor left/right' for Home/End and 'fn + up/down' for PgUp/PgDown, via For PC Users: Use PC Style Home/End, Use PC Style PageUp/PageDown; switching the function keys to work like on 'PC'. If you're using a Windows keyboard on your Mac, you can remap the modifier key locations to make your life easier. Read more at 9to5Mac: http://9to5mac.com/2. Under macOS Sierra 10.12, the mechanism for key remapping was changed. This Technical Note is for developers of key remapping software so that they can update their software to support macOS Sierra 10.12.

Which Keys Can You Remap?

There are several sets of keys on your Mac keyboard that perform individual functions. You can modify the functions of some keys, but there are some that you cannot. Among the sets of keys that the functions of which you can easily change and remap according to your needs are the function and modifier keys.

The function keys are usually located at the top most part of your keyboard and are either marked with a letter F followed by a number (e.g. F1, F2, F3, etc.) or an icon that signifies what they do (e.g. sun icon for brightness and speaker icon for volume).

The modifier keys, on the other hand, are the sets of keys that you use in combination with another key to perform specific functions like the CMD, CTRL, Caps Lock, Shift, and Option keys.

What Do Function Keys Do?

Traditionally, Function keys were designed to work as shortcuts to system-related commands usually buried under convoluted menus and submenus; however, since they are not frequently used by the average user, Function keys have been increasingly remapped to provide quick access to basic customization tools (like brightness or volume control) although their traditional functions have not been completely removed but simply delegated to the backseat instead.*

For example, in the current Mac keyboard design,

  1. Pressing F1 reduces brightness.
  2. Pressing F2 increases brightness.
  3. Pressing F3 lets you switch to “Expose” view to see all running programs or apps.
  4. Pressing F4 gives you quick access to business, communication and Internet tools.
  5. Pressing F7 lets you rewind a video that you were watching.
  6. Pressing F8 displays thumbnails of your current work spaces.
  7. Pressing F9 launches “Mission Control.”
  8. Pressing F10 shows all open windows for the active application.
  9. Pressing F11 hides all open windows and shows the desktop instead.
  10. Pressing F12 shows or hide the dashboard.

*To use the traditional functions of the Function keys, you have to press F1 or F2 together with the Fn key.

**F5 and F6 has no specific function attached to it by default.

What Do Modifier Keys Do?

Like Function keys, modifier keys also work as keyboard shortcuts to frequently used commands. Some examples of commands that your modifier keys are assigned to perform by default are:

  1. Command+A which selects all items in the active window
  2. Command+C which copies highlighted items.
  3. Command+X Cuts the selected items
  4. Command+F which opens the “Find” dialog
  5. Command+I which shows additional information about the currently selected item.
  6. Command+M which minimizes the active window
  7. Command+Z which undoes a previous action
  8. Command+V which pastes items previously cut or copied
  9. Command+O which opens the selected item
  10. Command+W which closes the active window

Aside from being used as keyboard shortcuts for system-wide commands, modifier keys can also be used to execute application-specific commands like:

  1. Command+Option+Space which opens the “Spotlight” menu.
  2. Command+Shift+A which opens the “Applications” folder.
  3. Command+Shift+U which opens the “Utilities” folder
  4. Command+Shift+I which connects you to your iDisk
  5. Shift–Command–(?) which opens the “Help” menu.

How to Remap Keys on Your Mac

If you are not happy with the default functions of your Function and Modifier keys, you can easily remap the keys on your Mac to assign keyboard shortcuts according to your specific needs and preferences.

To remap the Function keys and change how they work,

Go to the Apple menu

  1. Open “System Preferences,”
  2. Click on the “Keyboard” tab.
  3. Select “Shortcuts.”
  4. Select “Use all F1, F2, etc. keys as standard function keys.

To remap the modifier keys and assigned new key combinations for shortcuts,

Keys
  1. Follow Steps 1 to 3
  2. Click on “Modifier Keys.”
  3. Select the modifier key that the function of which you wish to change.
  4. Choose the new action that you want the modifier key to do when clicked on.

This works for system-wide commands; however, you can also remap keys to perform certain functions while particular certain apps.

To do this,

  1. Follow Steps 1 to 4
  2. Select “App Shortcuts.”
  3. Click on the “Add” button (the one with the plus icon).
  4. Click on “Application”
    1. Choose the application for which you want to use the new keyboard shortcut.
    2. If you can’t find the app that you want on the list, choose “Other” then find the app by using the “Open” dialog (note that some apps do not allow users to create custom keyboard shortcuts).
    3. If you want to use the same shortcut for multiple applications, select “All Applications.”
  1. Go to the “Menu Title” field.
    1. Type the menu command for which you want to create a new shortcut, like “Merge All Windows,” for example.
    2. If the menu command that you wish to make a shortcut for takes several steps to reach, type the menu command in the exact order of steps that you need to do to reach that particular command, with each step separated by the “>” character. For example, if you want to create a shortcut to the “Export to PDF” command, type in “File > Export to PDF” in the “Menu Title” field.
  1. After that, go to the “Keyboard Shortcut” field, then press the combination of keys that you want to use for your custom keyboard shortcut.
  2. Click “Add.”
  3. Follow the same steps if you want to create separate keyboard shortcuts for specific apps.

Just make sure that the new keyboard shortcut that you created isn’t already assigned to another command. Otherwise, it’s not going to work unless you will change the shortcut that was created first. If you don’t know which keyboard shortcuts have already been assigned to which commands, you can use this detailed list for reference.

Last updated 3 Nov 2017

A wireless presenter is a very useful device for switching between the full-screen slides in a presentation. This document explains how to remap the keys of the presenter, to make it work with a specific presentation software.

A wireless presenter is basically just a wireless keyboard with very few keys. The most important of these keys are the Next and Previous keys, which are supposed to switch to the next and previous slide in the presentation, respectively.

In many presenters, the Next and Previous keys are mapped to Page Down and Page Up. This means that pressing the Next key on the presenter is really just the same thing as pressing Page Down on the computer keyboard.

These default functions of presenter keys are chosen like this, because many presentation applications (for example, Microsoft Power Point) used Page Up and Page Down to switch between slides in presentation mode.

However, your specific presentation software might use other keys for switching between slides, and in this case the presenter seems to “not work”.

If your presenter doesn’t work with your presentation software, you need to know two things in order to make it work:

  1. What function do the keys on your presenter have?
  2. Which keys does your presentation software use?

To find out the functions of the keys on your presenter, open Apple’s built-in Keyboard Viewer. You find it in the Input Menu of the menu bar, as shown below:

If you click Show Keyboard Viewer, a small keyboard appears on the screen, which highlights every key as it is pressed.

Now, just press all the keys on your presenter and observe which keys get highlighted in the Keyboard Viewer.

Example: Logitech R700

The Logitech R700 Presenter has four keys, as show on this picture:

The functions of these keys, as revealed by Keyboard Viewer, are as follows:

Presenter KeyFunction
NextPage Down
PreviousPage Up
Start/StopAlternating between F5 and Esc
Hide. (period)

These functions are clearly targeted at Microsoft Power Point under Windows. F5 enters Slide Show Mode and Esc exits it. The dot key hides the current slide.

Different presentation applications use different keys for these tasks. Even Microsoft Power Point under Mac uses Cmd-Shift-Enter to enter Slide Show Mode, rather than F5.

So, now you have to find out which keyboard shortcuts your specific presentation application uses.

You can check if the keyboard shortcuts of your application are listed in the application’s manual. If not, you can search it on Google, or simply trying it out in the application.

These keys will be the targets to which you need to remap the keys of your presenter.

In case you want to enter Page Up and Page Down on a Mac keyboard, use fn-Arrow Up and fn-Arrow Down, respectively.

Example: Preview

Preview is the default PDF and image viewer of macOS, and it can be used for presentations in PDF format (you can also use Preview for photo slideshows)

The presentation control keys of Preview are as follows:

TaskKey Function
Next slideArrow Right
Previous slideArrow Left
Start slideshowCmd-Shift-F
End slideshowEsc
Hide current slidenot supported

So, based on the above examples, if we want to make the Logitech R700 presenter work with Preview slideshows, we have to do the following key remappings:

Presenter KeyOld FunctionNew Function
NextPage DownArrow Right
PreviousPage UpArrow Left
Start/StopF5Cmd-Shift-F

Since Preview has no “hide current slide” functionality, we don’t remap the period function of the Hide key on the presenter.

The Start/Stop key of the Logitech presenter has two functions that alternate (the alternation between them is managed internally by the presenter). One of these functions, Esc for ending the slideshow, works fine with Preview, so we don’t need to remap it. We just need to remap the F5 function used for starting the slideshow.

So, now how can we remap the key functions of an input device like the wireless presenter?

Karabiner is a Mac-based tool that allows to remap the keys for almost all kinds of input devices.

This basically means that whenever a key is pressed on an input device, Karabiner intercepts the signal sent by the device, checks if it has a remapping rule for this key, and if yes, changes the signal, and passes it on to the application which is receiving the input from this device.

So, if for example, a Page Down is remapped to a Arrow Left in Karabiner, the target application receives an Arrow Left, even if a Page Down has been pressed on the input device.

Remappings Per Device And Application

What’s particularly good with Karabiner is that it allows to do remappings application-specifc and device-specific. This means that you can define a remapping that applies only when both of the following conditions are met:

Remap Windows Shortcuts To Mac

  1. The input comes from a specified device
  2. A specified application has focus (i.e. is the receiver of the input device)

To show what this means, let’s assume we defined the remapping Page Down $rightarrow$ Arrow Right for the application Preview and for the device Logitech R700.

The following shows in which scenarios the remapping applies, and in which it does not:

  • Pressing Page Down on Logitech R700, and Preview in focus: applies
  • Pressing Page Down on Logitech R700, and another app in focus: does not apply
  • Pressing Page Down on another device, and Preview in focus: does not apply
  • Pressing Page Down on another device, and another app in focus: does not apply

This allows that the application-specific remappings of a device apply really only to this application, and not to other applications for which they might be inappropriate. For example, the presenter key remappings for Preview make no sense for Microsoft Power Point.

However, we could define another remapping for the same presenter device, but targeted at the Power Point application. Then, whenever we use the presenter with Preview, the Preview remapping applies, and whenever we use the presenter with Power Point, the Power Point remapping applies.

In the following, I’m going to describe how to implement the remappings listed above to make the Logitech R700 presenter work with Preview slideshows.

The same instructions apply to any other combinations of presenter and presentation application. You just have to adapt the key mappings, app ID, vendor ID, and product ID in the configuration JSON file accordingly, as explained below.

Download and Install

You can download and install the newest Karabiner version from here.

Make sure to pick the newest version (v11.1.0 or above). This version is is actually called Karabiner-Elements, in contrast to an older version (v10.22.0), which is just called Karabiner. The problem with the old version is that it doesn’t work on macOS Sierra (10.12) and above.

Adding a “Complex Modification” Rule

In order to implement the required remappings, we have to define a so-called “complex modification” for Karabiner.

Karabiner also has “simple modifications” which only allow the remapping of a single key to a single other key, and cannot be application-specific. So, this is not an option for our scenario.

A “complex modification” has to be defined in JSON and saved as a file in the following directory:

The following is the “complex modification” JSON file implementing the remappings from the above table:

The above file is specific to the Preview app and the Logitech R700 presenter. If you want to adapt it to another app and device, you have to adapt the app IDs, vendor IDs and product IDs accordingly, as described further below.

Structure of the JSON File

JSON is not very “human-readable”, but basically, we define a single element for the 'rules' array consisting of a 'description' and a 'manipulators' array. Each element of the 'manipulators' array is an object defining a single remapping from one key to another. Each of these objects has the following fields:

  • 'type'
  • 'from'
  • 'to'
  • 'conditions'

'from' defines the source key, and 'to' defines the target key.

'conditions' is an array of condition objects. In our case, there are two condition object in the array: the first one defines the device to which to apply by its vendor ID and product ID; the second one defines the app to which to apply by its app ID.

How To Find Out An App ID?

Every app on macOS has a unique app ID (or bundle ID), which usually has the form of an inverted domain name, like, for example, com.apple.Preview.

To find out the app ID of any application on your Mac, execute the following command:

Replace App Name with the name of the application. This name must be name displayed next to the  symbol in the menu bar when the application is running.

In the Karabiner JSON file, app IDs are specified as regular expressions of the form '^com.apple.Preview$'. Just leave the escape and control characters as they are.

For example, if your app ID is com.microsoft.Powerpoint, use the following in the JSON file:

How To Find The Vendor ID And Product ID Of A Device?

If your presenter is connected, you can see its vendor ID and product ID in the Devices tab of Karabiner, as shown below:

Note that the vendor ID and product ID listed in Karabiner are in decimal notation, and they must also be inserted in the JSON file in decimal notation.

Activating the Rule

After saving your JSON file to ~/.config/karabiner/assets/complex_modifications, in Karabiner go to the Complex Modifications tab, click Add Rule, and now the just installed rule should be listed there. Select it and click Enable, as shown in the following screenshots:

Note that whenever you make changes to the JSON file, you need to remove the rule in the Complex Modifications tab, and add it again, in order to reload the JSON file.

That’s it! Now the rule is enabled and applies whenever you use your specific presenter with your specified presentation applicatoin (and not otherwise, as desired).

Note that all remapping rules defined in Karabiner apply only when Karabiner is running (indicated by an icon in the menu bar).

Caveats

System modifier key settings

The current version of Karabiner ignores the modifier key settings in System Preferences > Keyboard > Modifier Keys…. If you have custom settings there and you don’t want Karabiner to undo them, you can add similar “simple modification” rules in the Simple Modifications tab of Karabiner.

Alternatively, you can completely exclude the input devices in question from being affected by Karabiner by unchecking them in the Devices tab, as shown below:

No documentation for defining complex modifications

There is currently no documentation of the JSON schema for defining complex modifications. The best one can do is to start from existing complex modification rules and edit them. There is a large collection of complex modification JSON files in this GitHub Repository.

By the way, most complex modifications of the above GitHub repository can be directly imported to Karabiner under Complex Rules > Add Rule > Import more rules from the Internet. They will be saved in the “complex modifications” directory listed above.

There is also a sample “complex modification” file provided by Karabiner here:

The names for the keyboard keys used by Karabiner (e.g. left_command) can be found out with the Karabiner-EventViewer app, which is included in the Karabiner installation. It displays the name of each key as it is pressed on the keyboard.

A list of all the keyboard key names can also be found in this GitHub issue comment.

There is also an old version of Karabiner (v10.22.0), which works up to macOS El Capitan (10.11).

The advantage of the old version is that the manual editing of the configuration file is more straightforward, as it is in XML rather than JSOn, and that it does not suffer from the caveat of ignoring the modifier key settings in System Preferences > Keyboard > Modifier Keys…, that is described above for the new version.

The disadvantage of the old version is that it does not work on macOS Sierra (10.12) and above.

For completeness, here is how to perform the same remapping scenario with the old Karabiner version.

How To Use The Old Karabiner Version

The old Karabiner version can also be installed from the Karabiner website. Make sure to choose the 10.22.0 version labelled Karabiner, rather than Karabiner-Elements.

Remap Mac Keyboard To Windows

After installing it, go to the Misc & Uninstall Tab and click Open private.xml, as shown below:

This opens the directory of the private.xml file in Finder. This is the configuration file that contains all the custom remapping rules.

You can also directly find the file here:

Edit the private.xml file to look like this:

Structure of the XML Configuration File

In the <appdef> tag, we declare the target application of the rule by the means of its app ID. How to find out the app ID of an application is explained here. For the name in <appname>, you can choose any identifier.

In the <devicevendordef> and <deviceproductdef> tags, we declare the vendor ID and the product ID of the target device, respectively.

To find out the vendor ID and product ID of a device, go to  > About This Mac > System Report…. In the window that pops up, locate the category of your device in the left column. If your device is a presenter with a USB receiver, it is listed under Hardware > USB. If you click on your device in the main panel, information about it is displayed in a panel below. This information should include the device’s vendor ID and product ID.

Note that the vendor ID and product ID listed in the System Report are in hexadecimal notation, and they must be entered in the Karabiner XML file in hexadecimal notation.

For the <vendorname> and <productname> tags, you can choose any identifier.

Finally, in the <item> tag we define the rule itself. We reference the previously declared application in the <only> tag, and the device in the <device_only> tag by the means of the identifiers that we chose. Then we define the individual key remappings of the rule in the <autogen> tags.

Activating the Rule

After saving the private.xml file, go to the Change Key tab in Karabiner, and click Reload XML. Now the item defined in private.xml should appear in the list. Check its checkbox to activate it, as shown below:

And that’s it again! Now the rule is activated, and the remapping rules apply whenever you use your specific presenter device with the specified application.

Note again that the remappings are only applied when Karabiner is running.

Once you know how to remap the keys of your presenter with Karabiner, you can use it for much more than just presentations.

Remap Keys Windows 10

For example, I remapped the keys of my presenter to the keyboard shortcuts used by the Google Play Music player (running in a web browser). In this way, I can use the presenter as a remote control for my music player.

You can, for example, also make your presenter a remote control for YouTube by mapping the keys to the YouTube shortcuts listed here.

Since the remapping rules are application-specific, they don’t interfer with each other, and you can switch back and forth between different applications running at the same time, and your presenter always performs the right action.

  • Two blog posts addressing a similar problem: 2012/08 and 2014/08
  • Collection of Karabiner “complex modifications” (for new Version of Karabiner)




Coments are closed