- Saved searches
- Use saved searches to filter your results more quickly
- License
- Helbis/keychron_function_keys_linux
- Name already in use
- Sign In Required
- Launching GitHub Desktop
- Launching GitHub Desktop
- Launching Xcode
- Launching Visual Studio Code
- Latest commit
- Git stats
- Files
- README.md
- About
- Saved searches
- Use saved searches to filter your results more quickly
- License
- adam-savard/keyboard-function-keys-linux
- Name already in use
- Sign In Required
- Launching GitHub Desktop
- Launching GitHub Desktop
- Launching Xcode
- Launching Visual Studio Code
- Latest commit
- Git stats
- Files
- README.md
- About
- echosergio / keychron-linux-function-keys.md
- Saved searches
- Use saved searches to filter your results more quickly
- License
- SamuelMB/keychron_function_keys_linux
- Name already in use
- Sign In Required
- Launching GitHub Desktop
- Launching GitHub Desktop
- Launching Xcode
- Launching Visual Studio Code
- Latest commit
- Git stats
- Files
- README.md
- About
Saved searches
Use saved searches to filter your results more quickly
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.
A small script to allow the Keychron K2 Keyboard to boot up with function keys enabled by default.
License
Helbis/keychron_function_keys_linux
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Sign In Required
Please sign in to use Codespaces.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching Xcode
If nothing happens, download Xcode and try again.
Launching Visual Studio Code
Your codespace will open once ready.
There was a problem preparing your codespace, please try again.
Latest commit
Git stats
Files
Failed to load latest commit information.
README.md
Enable Function Keys On The Keychron K2 and K3 Mechanical Keyboard Under Linux
Below, you’ll find the steps required to create a systemd command that will run at boot to disable the media keys and restore f1-f12 functionality.
Open a terminal window and create a new file in the folder /etc/systemd/system/
File should be named keychron.service
sudo nvim /etc/systemd/system/keychron.service
Paste the following code into the window:
[Unit] Description=The command to make the Keychron K2-K4 work with Function keys [Service] Type=oneshot SyslogIdentifier=keychron ExecStart=/bin/bash -c "sudo echo 0 | sudo tee /sys/module/hid_apple/parameters/fnmode" RemainAfterExit=true Restart=on-failure RestartSec=10s [Install] WantedBy=multi-user.target
To exit nvim press escape then : then w q and enter .
In the terminal, in order to enable the service type the following:
sudo systemctl enable keychron
To see the changes right away run last command:
sudo systemctl start keychron
If you want to simply drag/drop the file that you create manually in the steps provided, I have it under the scripts folder in this repo. Download it and drop it in /etc/systemd/system/ , doing Step 3 at the end.
For further info about systemd read freedesktop.org/. /systemd
About
A small script to allow the Keychron K2 Keyboard to boot up with function keys enabled by default.
Saved searches
Use saved searches to filter your results more quickly
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.
A small script to allow various keyboards to boot up with function keys enabled by default.
License
adam-savard/keyboard-function-keys-linux
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Sign In Required
Please sign in to use Codespaces.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching Xcode
If nothing happens, download Xcode and try again.
Launching Visual Studio Code
Your codespace will open once ready.
There was a problem preparing your codespace, please try again.
Latest commit
Git stats
Files
Failed to load latest commit information.
README.md
Update : December 15th, 2022
This repository was originally named after the Keychron K2 keyboard, but after multiple other keyboards were reported to work, I decided to make the name more generic.
To be clear, this solution will not work without systemd ; a crontab could work as well if you don’t have systemd .
If you confirm that your keyboard works with this script as expected, create a ticket and I’ll add it to the list of user-tested keyboards. Alternatively, submit a PR with a modification to this readme.
Enable Function Keys On Keychron/Various Mechanical Keyboards Under Linux, with systemd
(or, disable pesky media keys)
Below, you’ll find the steps required to create a systemd command that will run at boot to disable the media keys and restore f1-f12 functionality.
Open a terminal window and enter the following command:
# Set the EDITOR variable with EDITOR=nano, uncommenting the line directly below # EDITOR=nano sudoedit /etc/systemd/system/keychron.service
Paste the following into the window:
[Unit] Description=Disable media keys and substitute in function keys [Service] Type=simple RemainAfterExit=yes ExecStart=/bin/bash -c "echo 0 > /sys/module/hid_apple/parameters/fnmode" ExecStop=/bin/bash -c "echo 1 > /sys/module/hid_apple/parameters/fnmode" [Install] WantedBy=multi-user.target
Press ctrl+o and then ctrl+x to exit.
In the terminal, type the following:
systemctl enable keychron
That’s it! A reboot, and you’ll see that the function keys have been re-enabled. Alternatively, run this command to see the changes right away: systemctl start keychron
If you want to simply drag/drop the file that you create manually in the steps provided, I have it under the scripts folder in this repo. Download it and drop it in /etc/systemd/system/ , doing Step 3 at the end.
About
A small script to allow various keyboards to boot up with function keys enabled by default.
echosergio / keychron-linux-function-keys.md
On Linux, the Keychron K2 doesn’t register any of the F1-F12 function keys as actual F keys, instead, treating them as multimedia keys by default.
This section of the document describe how to change the behavior of ‘fn’ key to better match what user expect.
Here a description of each behavior :
- 0 = disabled : Disable the ‘fn’ key. Pressing ‘fn’+’F8’ will behave like you only press ‘F8’
- 1 = fkeyslast : Function keys are used as last key. Pressing ‘F8’ key will act as a special key. Pressing ‘fn’+’F8’ will behave like a F8.
- 2 = fkeysfirst : Function keys are used as first key. Pressing ‘F8’ key will behave like a F8. Pressing ‘fn’+’F8’ will act as special key (play/pause).
- Set the keyboard to Windows mode via the side switch
- Use Fn + X + L (hold for 4 seconds) to set the function key row to «Function» mode.
- echo 2 | sudo tee /sys/module/hid_apple/parameters/fnmode
- Optionally, reboot sudo reboot
Once complete, my F1-F12 keys work properly, and holding Fn turns them into multimedia keys. You can use the evtest utility to check how keyboard keys are registering until you get the above combination of settings configured properly.
To persist this change, add a module option for hid_apple :
echo "options hid_apple fnmode=2" | sudo tee -a /etc/modprobe.d/hid_apple.conf
You may need to rebuild your initramfs if hid_apple is included.
sudo update-initramfs -u -k all
To (re-)load the module for immediate use, run
sudo modprobe -r hid_apple; sudo modprobe hid_apple
Saved searches
Use saved searches to filter your results more quickly
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.
A small script to allow the Keychron K2 Keyboard to boot up with function keys enabled by default.
License
SamuelMB/keychron_function_keys_linux
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Sign In Required
Please sign in to use Codespaces.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching Xcode
If nothing happens, download Xcode and try again.
Launching Visual Studio Code
Your codespace will open once ready.
There was a problem preparing your codespace, please try again.
Latest commit
Git stats
Files
Failed to load latest commit information.
README.md
Enable Function Keys On The Keychron K2 and K3 Mechanical Keyboard Under Linux
Below, you’ll find the steps required to create a systemd command that will run at boot to disable the media keys and restore f1-f12 functionality.
Open a terminal window and create a new file in the folder
/etc/systemd/system/.
File name should be keychron.service
sudo nvim /etc/systemd/system/keychron.service
nvim can be exchanged for any editor of your choice for example doom emacs.
Paste the following code into the window:
[Unit] Description=The command to make the Keychron K2-k4 work with Function keys [Service] Type=oneshot ExecStart=/bin/bash -c "sudo echo 1 | sudo tee /sys/module/hid_apple/parameters/fnmode" ExecStop=/bin/bash -c "sudo echo 0 | sudo tee /sys/module/hid_apple/parameters/fnmode" [Install] WantedBy=multi-user.target
To exit nvim press escape then : then w q and enter.
In the terminal, in order to enable the service type the following:
sudo systemctl enable keychron
To see the changes right away run last command:
sudo systemctl start keychron
If you want to simply drag/drop the file that you create manually in the steps provided, I have it under the scripts folder in this repo. Download it and drop it in /etc/systemd/system/ , doing Step 3 at the end.
About
A small script to allow the Keychron K2 Keyboard to boot up with function keys enabled by default.