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
There are several options for drivers:
- linux-g13-driver-gitAUR is a maintained user-space driver written in C++, with a Qt6 configuration tool for key bindings, macros, backlight and profiles. It is a modernized fork of the older linux-g13-driver; see #linux-g13-driver and the README.
- g13-gitAUR is an unmaintained user-space driver that provides the
g13ddaemon; see #g13d. - Running the official Logitech Gaming Software under Wine. Despite working fine, the software has a garbage rating on WineHQ, as it cannot actually communicate with USB devices (however, the reports available are quite old, and you may have better luck).
linux-g13-driver
Setup
Install the linux-g13-driver-gitAUR package. It provides:
linux-g13-driver, the driver. It talks to the G13 via libusb and sends key events through/dev/uinput, so it works the same on Wayland and X11.g13-gui, the configuration tool, with an application menu entry (G13 Config Tool) and a tray icon that is started at login via XDG autostart (g13-gui --tray).- A udev rule (
/usr/lib/udev/rules.d/70-g13.rules) that grants the user of the active local session access to the G13 and to/dev/uinputviauaccess. No extra group membership is needed. - The systemd user unit
g13.service.
The driver runs as your normal user, not as root. Start/enable the user unit:
$ systemctl --user enable --now g13
The driver detects the G13 when it is plugged in and reopens it after it was unplugged. Check its log with:
$ journalctl --user -u g13
g13-gui --tray exits after 30 seconds; start the configuration tool from the application menu instead.Usage
When the G13 is connected or the driver starts, the LCD shows a short start animation: a flame wall burns away the firmware's "G13" logo and reveals Tux and a new logo. It can be disabled, see #settings.properties.
Start the configuration tool from the application menu, with g13-gui, or by clicking the tray icon. The tray menu can also start, stop and restart the driver.
- Key Bindings: click a key in the G13 image, then choose
- Key code (pass-through): click into the input field and press the key on your keyboard,
- Macro: a macro ID and the run mode (Run once, Repeat while held or Run several times),
- No action.
- Backlight Color: the RGB color of the selected profile.
- Macro Recorder: records key presses including their timing; the steps can be edited, moved and inserted manually.
- Options > Start animation on the display: turns the start animation on or off.
All changes are written to ~/.config/g13/. The driver reloads the bindings of the active profile automatically, no restart is needed.
The configuration tool follows the system language; translations exist for German, French, Italian, Spanish and Portuguese, all other languages use English.
Profiles
The four buttons below the display (L1–L4) switch between four profiles, stored in bindings-0.properties to bindings-3.properties. These buttons cannot be bound. The backlight button next to them is handled by the device itself.
Configuration files
All files are located in ~/.config/g13/. If no profile exists, the driver creates one with default bindings on the first start. Lines starting with # are comments; comments must be on their own line.
bindings-N.properties
~/.config/g13/bindings-0.properties
# backlight R,G,B (0-255) color=0,0,255 # physical key G4 sends W (Linux key code 17) G3=p,k.17 # physical key G5 runs macro 3 once G4=m,3,0
p,k.codesends a single key. The code is the Linux key code from/usr/include/linux/input-event-codes.h, e.g.KEY_Wis 17.m,id,moderuns the macromacro-id.properties.modeis0(run once),1(repeat while held) or a numbern> 1 (run n times). Pressing the key again while the macro runs stops it.
The key names in the file are numbered from 0 and do not match the labels on the device:
| Key on the device | Name in the file |
|---|---|
G1–G22 |
G0–G21
|
BD (round button left of L1) |
G24
|
L1–L4 |
G25–G28 (profile switch, cannot be bound)
|
M1, M2, M3, MR |
G29–G32
|
Thumb button left of the joystick (LEFT) |
G33
|
Thumb button below the joystick (DOWN) |
G34
|
Joystick press (TOP) |
G35
|
| Joystick up, left, right, down | G36, G37, G38, G39
|
macro-N.properties
~/.config/g13/macro-3.properties
name=Copy id=3 sequence=kd.29,d.40,kd.46,d.60,ku.46,d.30,ku.29
The sequence consists of kd.code (press key), ku.code (release key) and d.ms (wait in milliseconds), separated by commas without spaces. Up to 200 macros (macro-0 to macro-199) are possible. A changed macro becomes active the next time the bindings are loaded: after a change of the profile's bindings file, a profile switch or a restart of the driver.
settings.properties
Settings for all profiles:
~/.config/g13/settings.properties
# 1 = play the start animation (default), 0 = show the logo directly intro=1
LCD
Text written to the named pipe $XDG_RUNTIME_DIR/g13-lcd is shown on the LCD in a 5×7 font; each text line becomes one display line (five lines fit completely). It replaces the display content and stops a running start animation:
$ echo -e "CPU: 50%\nRAM: 4GB" > "$XDG_RUNTIME_DIR/g13-lcd"
The pipe is only accessible by your own user. Images cannot be sent through it.
g13d
The following sections apply to g13d from g13-gitAUR.
g13-gitAUR installs the g13d daemon and a systemd service that runs g13d as user/group g13. It also sets up rules for udev to identify your G13 device and automatic starting and stopping of the service by connecting or unplugging by default.
Usage
After following the steps above, when you reboot and launch g13d (either manually or automatically through systemd), you should receive an image with a "linux inside" logo, "G13", and the GNU logo.
Configuration
/run/g13d/g13-0 instead of the default /tmp/g13-0.g13d is configured in one of two ways, either by writing commands to /run/g13d/g13-0, or preferably by specifying keybindings and commands in a configuration file which is read at launch.
When running g13d manually you can specify a configuration file using the --config parameter, and when running as a service the file /etc/g13/default.bind will be used.
/etc/g13/default.bind is the easiest option. You may need to create the /etc/g13 directory if it was not created during initial install.Manual commands can also be evoked one at a time by manually writing to /run/g13d/g13-0:
For example, to set the display a purple colour:
$ echo "rgb 177 13 201" > /run/g13d/g13-0
g13 can also handle multiple commands at once:
$ echo -e "rgb 177 13 201\nbind G4 KEY_W" > /run/g13d/g13-0
#. You can use this to make files full of commands and run cat file > /run/g13d/g13-0 when you are ready to play.Commands
rgb
Set the backlight to an rgb colour, values are expressed in decimal from 0 to 255.
rgb rrr ggg bbb
For example, to set the display green:
rgb 0 255 0
bind
Binds a G13 key. All keys are bound to a by default.
bind g13key actual_key
For example, to setup WASD movement:
bind G4 KEY_W bind G10 KEY_A bind G11 KEY_S bind G12 KEY_D
See below for how to configure this.
mod
Sets the backlight status of M1, M2, M3, and MR.
mod n
Where n is a bitmask. To find the desired state compute the sum of 1 (M1), 2 (M2), 4 (M3) and 8 (MR).
For example, to set M1, M3, and MR on, and turn M2 off (1+4+8=13):
mod 13
Keys
Keys to map to (should be self explanatory)
KEY_0 KEY_1 KEY_2 KEY_3 KEY_4 KEY_5 KEY_6 KEY_7 KEY_8 KEY_9 KEY_A KEY_APOSTROPHE KEY_B KEY_BACKSLASH KEY_BACKSPACE KEY_C KEY_CAPSLOCK KEY_COMMA KEY_D KEY_DOT KEY_DOWN KEY_E KEY_ENTER KEY_EQUAL KEY_ESC KEY_F KEY_F1 KEY_F10 KEY_F2 KEY_F3 KEY_F4 KEY_F5 KEY_F6 KEY_F7 KEY_F8 KEY_F9 KEY_G KEY_GRAVE KEY_H KEY_I KEY_J KEY_K KEY_KP0 KEY_KP1 KEY_KP2 KEY_KP3 KEY_KP4 KEY_KP5 KEY_KP6 KEY_KP7 KEY_KP8 KEY_KP9 KEY_KPASTERISK KEY_KPDOT KEY_KPMINUS KEY_KPPLUS KEY_L KEY_LEFT KEY_LEFTALT KEY_LEFTBRACE KEY_LEFTCTRL KEY_LEFTSHIFT KEY_M KEY_MINUS KEY_N KEY_NUMLOCK KEY_O KEY_P KEY_Q KEY_R KEY_RIGHT KEY_RIGHTBRACE KEY_RIGHTSHIFT KEY_S KEY_SCROLLLOCK KEY_SEMICOLON KEY_SLASH KEY_SPACE KEY_T KEY_TAB KEY_U KEY_UP KEY_V KEY_W KEY_X KEY_Y KEY_Z
Keys to map
BD DOWN G1 G10 G11 G12 G13 G14 G15 G16 G17 G18 G19 G2 G20 G21 G22 G3 G4 G5 G6 G7 G8 G9 L1 L2 L3 L4 LEFT LIGHT LIGHT_STATE M1 M2 M3 MR TOP STICK_LEFT STICK_RIGHT STICK_UP STICK_DOWN
Key layout
Where the keys physically are on the device (names as printed on the G13; see #bindings-N.properties for the names used by linux-g13-driver):
Keypad:
______________
| 160x43 LCD |
| |
‾‾‾‾‾‾‾‾‾‾‾‾‾‾
BD L1 L2 L3 L4 LIGHT_STATE
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 TOP STICK_RIGHT
F STICK_DOWN
T
DOWN