Logitech G13
The Logitech G13 is a 25-key "advanced gameboard" from Logitech's Gaming series, with the intention of replacing the left half of your keyboard whilst gaming. It uses rubber dome key switches for the main 22-keys, mouse-like buttons for the two buttons around the joystick, a joystick (which can be pressed in), four Mode buttons, four option buttons, a menu button, and a backlight toggle.
Installation
Since Linux 6.19, the G13 is supported by the kernel driver hid-lg-g15, which is loaded automatically when the device is plugged in. No separate driver needs to be installed: the official linux kernel provides the keys, the joystick, the backlight and the mode LEDs out of the box.
- Kernels older than 6.19 do not support the G13. Check the running kernel with
uname -r, especially when using an LTS or other alternative kernel. - The user-space drivers formerly needed for the G13 (linux-g13-driver-gitAUR, g13-gitAUR) are not needed any more and take the device away from the kernel driver. See #Former user-space drivers.
What the kernel provides
The driver creates two input devices, Logitech G13 Gaming Keypad and Logitech G13 Thumbstick, and LED devices in /sys/class/leds/:
| Key on the device | Event |
|---|---|
G1–G22
|
KEY_MACRO1–KEY_MACRO22
|
L1–L4
|
KEY_KBD_LCD_MENU1–KEY_KBD_LCD_MENU4
|
BD (round button left of L1) |
KEY_KBD_LCD_MENU5
|
M1, M2, M3
|
KEY_MACRO_PRESET1–KEY_MACRO_PRESET3
|
MR |
KEY_MACRO_RECORD_START
|
| Backlight button |
KEY_LIGHTS_TOGGLE
|
| Thumb button left of the joystick |
BTN_BASE (thumbstick device)
|
| Thumb button below the joystick |
BTN_BASE2 (thumbstick device)
|
| Joystick press |
BTN_THUMB (thumbstick device)
|
| Joystick axes |
ABS_X, ABS_Y, range 0–255 (thumbstick device)
|
| LED | Name in /sys/class/leds/
|
|---|---|
| Backlight (RGB) |
g13:rgb:kbd_backlight
|
M1, M2, M3
|
g13:red:macro_preset_1 to g13:red:macro_preset_3
|
MR |
g13:red:macro_record
|
You can check the events with evtest and set the backlight colour by hand, e.g. blue (the order of the values is given in multi_index):
$ cat /sys/class/leds/g13:rgb:kbd_backlight/multi_index # echo "0 0 255" > /sys/class/leds/g13:rgb:kbd_backlight/multi_intensity
The joystick works as a normal joystick in games without further setup. The kernel driver does not drive the LCD; it is accessible through hidraw (see #gkey-config).
Configuration
Most applications do not understand the KEY_MACROn events, so the G keys have to be assigned to ordinary keys, key combinations or macros. This can be done with gkey-config, a configuration tool written for the kernel driver, or with a generic tool from Input remap utilities.
gkey-config
Install the gkey-configAUR package. It works on top of hid-lg-g15 and installs no driver of its own. It provides:
-
gkeyd, a daemon running as a systemd user unit (gkeyd.service). It takes the G13 input devices exclusively, sends the configured keys through/dev/uinput, sets the LEDs and draws on the LCD. It works the same on Wayland and Xorg. -
G-Key Configuration (
gkey-config), the configuration tool, with an application menu entry and a tray icon that is started at login via XDG autostart. - A udev rule that grants the user of the active local session access to the G13, its LCD (
hidraw) and/dev/uinputviauaccess. - The group
gkey, which may change the LEDs (sysfsattributes cannot carry ACLs).
On its first start, G-Key Configuration offers to start the daemon at every login and to allow LED control by adding your user to the group gkey (it asks for the administrator password via polkit). Both can be changed later in the Settings menu. The same by hand:
$ systemctl --user enable --now gkeyd # gpasswd -a username gkey
After joining the group, log out completely and back in. Check the daemon log with:
$ journalctl --user -u gkeyd
- gkey-config conflicts with linux-g13-driver-gitAUR; remove it first.
- The tray icon requires a system tray. On GNOME, install the AppIndicator and KStatusNotifierItem Support extension. Without a tray, the configuration tool still works from the application menu.
Usage
Click a key in the picture of the G13, or press it on the device, and choose what it does: a key, a key combination, a mouse button, a macro, a switch of layer or profile, or an LCD page. Changes are applied immediately.
-
Layers:
M1–M3switch between three layers of bindings per profile; the M LEDs show the active layer. - Profiles: any number of profiles, each with its own bindings, backlight colour and joystick mode.
-
Macros: recorded from the keyboard or started with
MRon the device, edited step by step, and run once, while held, as a toggle or a fixed number of times. - Joystick: keys for the four directions (diagonals press two of them), mouse pointer, scroll wheel or normal joystick, with adjustable dead zone.
-
LCD: pages for status (profile and layer), clock and text; the
BDbutton pages through them.
The configuration tool follows the system language; translations exist for German, French, Italian, Spanish and Portuguese, all other languages use English. If the device is plugged in but not usable, the status bar of the configuration tool names the reason, for example a kernel older than 6.19 or another program using the device.
Configuration files
| Path | Content |
|---|---|
~/.config/gkey-config/profiles/g13/*.json |
profiles, one file each |
~/.config/gkey-config/macros/*.json |
macros, shared by all profiles |
~/.config/gkey-config/settings.json |
LCD pages |
The files are JSON and may be edited by hand; the daemon reloads them on save. The formats are described in the design document. Example of a profile:
~/.config/gkey-config/profiles/g13/default.json
{
"name": "Default",
"backlight": [0, 0, 255],
"stick": { "mode": "keys" },
"modes": {
"M1": {
"G4": { "type": "key", "key": "KEY_W" },
"G2": { "type": "combo", "keys": ["KEY_LEFTCTRL", "KEY_C"] },
"STICK_UP": { "type": "key", "key": "KEY_W" }
},
"M2": {},
"M3": {}
}
}
Scripts
The daemon offers a D-Bus API on the session bus. For example, to show a text on the LCD for 5 seconds:
$ busctl --user call io.github.lordbooker.GKeyConfig /io/github/lordbooker/GKeyConfig io.github.lordbooker.GKeyConfig1 LcdText si "Build done" 5
Further calls switch profiles (SetProfile) and layers (SetMode), run macros (RunMacro) or return the state as JSON (Status); see the README.
Former user-space drivers
Before Linux 6.19, the G13 needed a user-space driver that talked to the device directly via libusb:
- linux-g13-driver-gitAUR, with a Qt configuration tool,
-
g13-gitAUR, an unmaintained driver that provides the
g13ddaemon, - the official Logitech Gaming Software under Wine, which cannot actually communicate with USB devices.
With a current kernel they are not needed any more. While running, they claim the G13 via libusb and detach the kernel driver, so the device is no longer available to hid-lg-g15 and gkey-config. Stop and remove them, e.g. for linux-g13-driver:
$ systemctl --user disable --now g13
and remove the package, then replug the G13. Their documentation remains in their repositories for systems with older kernels.
Key layout
Where the keys physically are on the device (names as printed on the G13; see #What the kernel provides for the events):
Keypad:
______________
| 160x43 LCD |
| |
‾‾‾‾‾‾‾‾‾‾‾‾‾‾
BD L1 L2 L3 L4 LIGHT
M1 M2 M3 MR
G1 G2 G3 G4 G5 G6 G7
G8 G9 G10 G11 G12 G13 G14
G15 G16 G17 G18 G19
G20 G21 G22
Joystick:
L STICK_UP
E STICK_LEFT STICK_PRESS STICK_RIGHT
F STICK_DOWN
T
DOWN
gkey-config uses these names, THUMB_LEFT for the thumb button left of the joystick (LEFT) and THUMB_DOWN for the one below it (DOWN).