How to make Apple keyboard work properly in Ubuntu

Kyle renfro has a solution for the Apple keyboard to work correctly in Ubuntu, when we say work correctly, we mean that the keys have the functionalities that they commonly have in 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 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

El fix-keyboard.service is a definition of service SystemD what will execute fix-keyboard.sh when our computer boots. To create it we must execute 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


Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.

  1.   Ray said

    gedit fix-keyboard.service
    and then
    sudo cp keyboard-fix.service /etc/systemd/system/keyboard-fix.service
    isn't something wrong there? 🙂