How to make Apple keyboard work properly in Ubuntu

Kyle Renfro has a solution to make Apple keyboards work correctly on Ubuntu. When we say "work correctly," we mean that the keys have the functionalities they commonly have on other keyboards.

What are we going to solve?

In these fixes that we are going to make, we will solve 3 small details:

  • We fix the Fn key.
  • We exchange the command / alt key.
  • The F13 key becomes the Insert key.

To make these corrections we are going to create 2 files the keyboard-fix.sh and the fix-keyboard.service apple keyboard

keyboard-fix.sh

The Keyboard-fix.sh will be the script in charge of solving the 3 problems in question, to create it we must execute the following command:

$ gedit keyboard-fix.sh

Inside the file we must place the following content:

#! / bin / sh #fix fn key echo 2> / sys / module / hid_apple / parameters / fnmode #swap command / alt echo 1> / sys / module / hid_apple / parameters / swap_opt_cmd # F13 = Insert echo "keycode 191 = Insert "| xmodmap -

Then I proceed to copy keyboard-fix.sh to / usr / bin.

$ sudo cp keyboard-fix.sh /usr/bin/keyboard-fix.sh

fix-keyboard.service

The `fix-keyboard.service` is a SystemD service definition that will execute `fix-keyboard.sh` when your computer starts. To create it, run the following command:

$ gedit fix-keyboard.service

Inside the file we must place the following content:

[Unit] Description = mac keyboard fix [Service] Type = oneshot ExecStart = / usr / bin / keyboard-fix.sh [Install] WantedBy = multi-user.target

We give save and then we must execute the following commands from the terminal:

sudo cp keyboard-fix.service /etc/systemd/system/keyboard-fix.service sudo systemctl daemon-reload sudo systemctl enable keyboard-fix.service sudo systemctl start keyboard-fix.service

With this procedure we get Apple keyboards to work as we want in our Ubuntu, with the execution of the daemon these fixes will be executed as soon as the system boots. A fairly simple solution to a common problem that many have


Add as preferred source in Google