logitech/

Remap the key between left shift and Z in Logitech MX Mechanical Mini in Linux

In Europe, Logitech only sells keyboards with ISO layout. This means that there is an additional key between the left shift and Z. This key is often in the way if you are used to the US layout (ANSI layout). Solaar does not allow you to remap this key.

  1. Install evtest:
sudo dnf install evtest
  1. Start it and find the device:
sudo evtest

evtest will output all available devices. For example:

No device specified, trying to scan all of /dev/input/event*
Available devices:
/dev/input/event0:	Sleep Button
/dev/input/event1:	Power Button
...
/dev/input/event27:	solaar-keyboard
/dev/input/event3:	Logitech USB Receiver
/dev/input/event4:	Logitech USB Receiver Mouse
/dev/input/event5:	Logitech USB Receiver Consumer Control
/dev/input/event6:	Logitech USB Receiver System Control

The keyboard is solaar-keyboard. However, it is connected via the USB receiver. This means that the device is /dev/input/event3.

  1. Record the key code by pressing the key:
Event: time 1692951945.797570, type 4 (EV_MSC), code 4 (MSC_SCAN), value 70064
Event: time 1692951945.797570, type 1 (EV_KEY), code 86 (KEY_102ND), value 1

If you selected solaar-keyboard as the device, evtest won’t record any key

  1. Create a new rule:
sudo vim /etc/udev/hwdb.d/mx-keys.hwdb

Add the following content:

evdev:name:Logitech USB Receiver:*
  KEYBOARD_KEY_70064=leftshift
  1. Update the rules to test the new configuration:
sudo systemd-hwdb update
sudo udevadm trigger
| 20 May 2024

Fix missing shortcuts in Logitech MX Mechanical Mini in Linux

Logitech MX Mechanical Mini keyboard works mostly great in Linux. However, there are few buttons which don’t: Mic mute, Screenshots, Emoji, Voice dictation. To fix it, install solaar and reboot your computer (important, otherwise the app will hang):

sudo dnf install solaar
reboot

Configuring every button is 2-step process.

On the first step, the button is marked as a custom button (Diverted):

On the second step, click Rule Editor in the bottom left corner and there you can assign a new action to it:

Solaar keeps configuration files in ~/.config/solaar/ directory. Rules are stored in ~/config/solaar/rules.yaml file:

%YAML 1.3
---
- Key: [MultiPlatform Search, pressed]
- KeyPress:
  - XF86_AudioNext
  - click
...
---
- Key: [Voice Dictation, pressed]
- Execute: [firefox, 'https://gemini.google.com']
...
---
- Key: [Snipping Tool, pressed]
- KeyPress:
  - Print
  - click
...
---
- Key: [Open Emoji Panel, pressed]
- Execute: gnome-characters
...
---
- Key: [Mute Microphone, pressed]
- KeyPress:
  - XF86_AudioMicMute
  - click
...

The configuration file is located in ~/.config/solaar/config.yaml and is unique for every keyboard. It contains the keyboard’s name, serial number and etc. Our modified configuration should look like this:

- 1.1.10
- _NAME: MX Mechanical Mini
  _absent: [hi-res-scroll, lowres-scroll-mode, hires-smooth-invert, hires-smooth-resolution, hires-scroll-mode, scroll-ratchet, smart-shift, thumb-scroll-invert,
    thumb-scroll-mode, onboard_profiles, report_rate, pointer_speed, dpi, speed-change, backlight-timed, reprogrammable-keys, persistent-remappable-keys,
    crown-smooth, divert-crown, divert-gkeys, m-key-leds, mr-key-led, gesture2-gestures, gesture2-divert, gesture2-params, sidetone, equalizer, adc_power_management]
  # <redacted>
  _sensitive: {divert-keys: true, multiplatform: false}
  # <redacted>
  backlight: true
  change-host: null
  disable-keyboard-keys: {1: false, 4: false, 8: false, 16: false}
  divert-keys: {212: 1, 226: 0, 227: 0, 231: 0, 232: 0, 233: 0, 259: 1, 264: 1, 266: 1, 267: 0, 268: 0, 269: 0, 270: 0, 271: 0, 272: 0, 273: 0, 274: 0,
    277: 0, 279: 0, 280: 0, 281: 0, 282: 0, 283: 0, 284: 1, 286: 0, 316: 0, 321: 0}
  fn-swap: false
  multiplatform: 0
| 26 Feb 2024