by Daniel Phillips

### Categories

After years of using a full size (and very old) Apple USB keyboard for my Mac, I recently bought a Logitech K380 bluetooth keyboard to try something smaller that would take up less space on the desk. It’s reasonably cheap (around £35), offered support for Mac and PC layouts and can pair with up to 3 devices at once. I bought an MX Master mouse years ago which has been fantastic, so I thought I should try a Logitech keyboard to see how they compare.

The keyboard itself is around the same physical size as the built-in Macbook keyboard, although it has round keys that take a little bit of getting used to. At first glance it looks like the keyboard has a very similar key layout to a Macbook, but there are some differences: there’s a dedicated delete key, fn and ctrl are swapped, and (as far as I can tell) there’s no key for page up, page down, home or end.

I’m missing these keys on the new keyboard, so I looked for options to bring them back. On the Macbook they’re available by pressing fn and then one of the cursor keys, but on the K380 pressing fn + up or fn + down adjusts brightness and fn + left and fn + right selects the word to the left or right. Some of this functionality appears to originate from the Logi Options software: the helper application and drivers from Logitech for configuring their devices. Removing this wasn’t really an option as I also have an MX Master mouse, and removing Logi Options disables a lot of the more advanced functionality of the mouse.

Logi Options happily informed me that there’s a new version of Logi Options called Logi Options+ Beta. I tried installing to see if that improved the situation with the keyboard, but it didn’t make any difference and didn’t appear to offer any new keyboard functionality over the original application. It did make life more confusing though! The new Beta doesn’t support the original MX Master so I was left with Logi Options to manage the mouse and Logi Options+ to manage the keyboard. I ended up deleting it, which broke Logi Options for my keyboard and finally required removing all trace of the application, preference files, and then uninstalling the original Logi Options and reinstalling Logi Options again. I might hold off on the Beta version for now…

After abandoning the Options+ adventure, it’s back to Logi Options again. Discussions on Reddit mentioned that it should be possible to map the F4-F7 function keys to a user-defined keystroke. If you happen to have a full-size USB keyboard sitting around, you can plug it in and then press one of the Home/End/Page Up/Page Down keys when defining the keystroke in Logi Options. Amazingly, this worked! It’s not as convenient as being able to use the function keys and it’s harder to find without looking at the keyboard, but much better than having no access to the function whatsoever. The keys also don’t repeat, so you need to repeatedly press the function key if you want to keep scrolling through your document.

What if you don’t have a USB keyboard lying around and you’ve just got your Macbook and a K380? Your first thought might be to use the fn + cursor key combo that’s available on the Macbook keyboard, but Logi Options doesn’t recognise that as Page Up/Down/Home/End. After some digging, it turns out you can fiddle with the Logi Options preferences to set this up by changing some of the preference file values.

Here’s what you need to do:

1. Install Logi Options. Don’t log in for now because we’re going to mess around with the settings and you don’t want to keep backing the settings up to the cloud. It’s fine to log in once you have things set up the way you like.
2. Open Logi Options and go to the configuration screen for the keyboard.
3. Click on one of the 4 configurable function keys and do the following:
1. Select Keystroke assignment.
2. Click in the box that appears and press any key on the keyboard (for example, I pressed Q).
4. Repeat step 3 for each of the keys you want to configure. Once you’re done, quit Logi Options.

These steps ensure that the appropriate sections of the preference file are created. Next, we’ll configure the mappings manually.

Logi Options stores the preferences for the keyboard in ~/Library/Preferences/com.logitech.manager.setting.0001b342.plist. This is where the remapped keystroke is defined for each key and what we need to update to remap it. It’s worth taking a backup of this file just in case.

Find the key that you want to remap in the table below and note the key code.

 Key KEY_CODE F4 0xbb F5 0xba F6 0xbc F7 0xbd

Open Terminal and run the command below, replacing KEY_CODE with the appropriate KEY_CODE value from the table above. For example, for F6 your key code would be 0xbc.

/usr/libexec/PlistBuddy -c "Print controlIDPreferences:KEY_CODE:assignmentData:0x49:keystroke" ~/Library/Preferences/com.logitech.manager.setting.0001b342.plist


If all is good, you should see a number printed to the the terminal which represents the key code of the currently assigned key. If you get an error, then retry the steps above to confirm that you’ve properly set up the key.

Assuming the previous command worked, you can now remap the key. Look in the table below to find the mapping for the key you want to assign to the function key:

 Key MAPPING Page Down 78 Page Up 75 Home 74 End 77

You’re now ready to remap the key with the command below. As before, replace KEY_CODE with the key code from the first table for the key on the K380 you want to configure and MAPPING with the appropriate value from the table above.

/usr/libexec/PlistBuddy -c "Set controlIDPreferences:KEY_CODE:assignmentData:0x49:keystroke MAPPING" ~/Library/Preferences/com.logitech.manager.setting.0001b342.plist


As an example, if you wanted to set the F4 key to Page Up, you’d enter the command below.

/usr/libexec/PlistBuddy -c "Set controlIDPreferences:0xbb:assignmentData:0x49:keystroke 75" ~/Library/Preferences/com.logitech.manager.setting.0001b342.plist


Finally, to get the new mappings to apply:

1. Open Activity Monitor
2. Select Logi Options Daemon from the list
3. Click the Stop button and then Force Quit
4. Open Logi Options again and your new mappings should now be set on your K380.