This page looks best with JavaScript enabled

Remap special keys Lenovo

 ·  ☕ 1 min read

Fist Step Identify the key pressed

launch command from terminal

acpi_listen

press the special key, in my case Fn+F11 and the output on the terminal is

cd/play CDPLAY 00000080 00000000 K

Acpi Event/Action

Now we will create 2 files

  • Event file to listen for user keypress
  • Action to perform
# create event
cd /etc/acpi/events
touch lenovo-playpause
# create executable action
cd /etc/acpi/actions
touch lenovo-playpause.sh
chmod +x lenono-playpause.sh

Event File

/etc/acpi/events/lenovo-playpause

#Fn+F11 cd/play CDPLAY 00000080 00000000 K
event=cd/play CDPLAY 00000080 00000000 K
action=/etc/acpi/actions/lenovo-playpause.sh

Action File

/etc/acpi/actions/lenovo-playpause.sh

#!/usr/bin/env bash

logger "[ACPI] Fn+F11 pressed, Rock'n Roll Time"

# ...continue

This file at the moment will print something on the system log file.
Fill it with your favorite action, the restart the service.

systemctl restart acpid

Test

In one terminal watch for log messages to appear

journalctl -f

In another watch for acpi events

acpid -c /etc/acpi/events/ -s /var/run/acpid.socket -f -d -l | tee mylog

Presse the key and on both terminal you’ll see output