This GNOME Shell extension allows you to control the red LED light on the back of ThinkPad laptops. With this extension, you can toggle between different LED states such as:
- LED Off
- LED On
- LED Blinking
The extension interacts directly with the kernel to manage the LED states via the ec_sys module.
- LED Control: Turn the LED on, off, or make it blink
- Morse Code Message: Input a text message and the extension will flash the LED in Morse code
- Boot Persistence: Automatically restore LED state after reboot (requires helper setup)
- No password prompts: After initial setup, LED control works without authentication dialogs
The easiest way to install is from GNOME Extensions.
-
Clone the repository:
git clone https://github.com/juanmagdev/ThinkPad-Red-Led-Control.git cd ThinkPad-Red-Led-Control -
Copy to extensions directory:
mkdir -p ~/.local/share/gnome-shell/extensions/thinkpad-red-led@juanmagd.dev cp -r * ~/.local/share/gnome-shell/extensions/thinkpad-red-led@juanmagd.dev/
-
Restart GNOME Shell (press
Alt+F2, typer, press Enter) or log out and back in -
Enable the extension using GNOME Extensions app or:
gnome-extensions enable thinkpad-red-led@juanmagd.dev
The extension uses a helper script to control the LED without requiring password prompts each time. Run the install script to set it up:
./install.shThis will:
- Install the helper to
/usr/local/bin/thinkpad-red-led-helper - Configure sudoers for passwordless execution
- Install and enable a systemd service for boot persistence
If the install script doesn't work, you can set up the helper manually:
-
Install the helper:
sudo install -o root -g root -m 0755 \ ~/.local/share/gnome-shell/extensions/thinkpad-red-led@juanmagd.dev/tools/thinkpad-red-led-helper \ /usr/local/bin/thinkpad-red-led-helper -
Configure sudoers:
sudo visudo -f /etc/sudoers.d/thinkpad-red-led
Add this line (replace
YOUR_USERNAMEwith your actual username):YOUR_USERNAME ALL=(root) NOPASSWD: /usr/local/bin/thinkpad-red-led-helper -
Enable boot persistence (optional):
sudo install -o root -g root -m 0644 \ ~/.local/share/gnome-shell/extensions/thinkpad-red-led@juanmagd.dev/tools/thinkpad-red-led-restore.service \ /etc/systemd/system/thinkpad-red-led-restore.service sudo systemctl daemon-reload sudo systemctl enable thinkpad-red-led-restore.service
The extension controls the ThinkPad LED by writing to the Embedded Controller (EC) interface at /sys/kernel/debug/ec/ec0/io.
The LED state is controlled by the 12th byte of the EC interface:
| State | Hex Value | Description |
|---|---|---|
| Off | 0x0a |
LED is off |
| On | 0x8a |
LED is on |
| Blinking | 0xca |
LED blinks |
The helper script (thinkpad-red-led-helper) supports these commands:
sudo thinkpad-red-led-helper on # Turn LED on
sudo thinkpad-red-led-helper off # Turn LED off
sudo thinkpad-red-led-helper blink # Make LED blink
sudo thinkpad-red-led-helper morse "text" # Flash morse code
sudo thinkpad-red-led-helper restore # Restore last saved stateYou can check the current EC state with:
sudo hexdump -C /sys/kernel/debug/ec/ec0/ioLook at byte 12 (offset 0x0c) to see the current LED state.
This can happen with Secure Boot or Kernel Lockdown enabled. Solutions:
-
Add kernel parameter (recommended): Add
ec_sys.write_support=1to your kernel command line in GRUB -
Disable Secure Boot (if acceptable for your setup)
The ec_sys module needs write support enabled. The helper tries multiple methods automatically, but if it fails:
# Check if module is loaded
lsmod | grep ec_sys
# Check write_support value
cat /sys/module/ec_sys/parameters/write_support-
Check if the extension is installed:
gnome-extensions list | grep thinkpad -
Check for errors:
journalctl -f -o cat /usr/bin/gnome-shell
- Support for GNOME 47, 48
- Support for uppercase letters in Morse code
- Boot persistence via systemd service
- Replace pkexec with sudo helper
- Add more languages (currently English only)
- Interface to control Morse code speed
- GNOME: 45, 46, 47, 48
- ThinkPad models: Models with the red LED on the back lid (most ThinkPad laptops)
- vali20 for the original idea: ThinkPad LED Control under GNU/Linux
- c5e3 for the Morse code script: Morse Code Script
- @yurijde for the persistance method, the sudo setup and fix some errors.
Contributions are welcome! Feel free to open pull requests with bug fixes or feature requests.
This project is licensed under the MIT License.
