Skip to main content
changed formatting, explained this is command line and for automate/customize
Source Link
Mark Paskal
  • 2.9k
  • 1
  • 25
  • 30

YouTo do this from the command line you can make changes to the color and program by writing a file in sysfs!. You can use this to automate or customize via scripts if you'd like.

The file is /sys/devices/platform/asus-nb-wmi/leds/asus::kbd_backlight/kbd_rgb_mode and you can operate on it as per the following examples. You write the file with a string in the format of six space separated numbers.

cat /sys/devices/platform/asus/sys/devices/platform/asus-nb-wmi/leds/asus::kbd_backlight/kbd_rgb_mode_index
 

The second number is mode which on my laptop can be as follows. I only checked up to 10. Setting it to a value that does nothing will just leave the keyboard on the previous setting.

You can make changes to the color and program by writing a file in sysfs! The file is /sys/devices/platform/asus-nb-wmi/leds/asus::kbd_backlight/kbd_rgb_mode and you can operate on it as per the following examples. You write the file with a string in the format of six space separated numbers.

cat /sys/devices/platform/asus/sys/devices/platform/asus-nb-wmi/leds/asus::kbd_backlight/kbd_rgb_mode_index
 

The second number is mode which on my laptop can be as follows. I only checked up to 10.

To do this from the command line you can make changes to the color and program by writing a file in sysfs. You can use this to automate or customize via scripts if you'd like.

The file is /sys/devices/platform/asus-nb-wmi/leds/asus::kbd_backlight/kbd_rgb_mode and you can operate on it as per the following examples. You write the file with a string in the format of six space separated numbers.

cat /sys/devices/platform/asus/sys/devices/platform/asus-nb-wmi/leds/asus::kbd_backlight/kbd_rgb_mode_index

The second number is mode which on my laptop can be as follows. I only checked up to 10. Setting it to a value that does nothing will just leave the keyboard on the previous setting.

deleted 26 characters in body
Source Link
Mark Paskal
  • 2.9k
  • 1
  • 25
  • 30

You can make changes to the color and program by writing a file in sysfs! The file is /sys/devices/platform/asus/sys/devices/platform/asus-nb-wmi/leds/asus::kbd_backlight/kbd_rgb_mode and you can operate on it as per the following examples. You write the file with a string in the format of six space separated numbers.

You can make changes to the color and program by writing a file in sysfs! The file is /sys/devices/platform/asus/sys/devices/platform/asus-nb-wmi/leds/asus::kbd_backlight/kbd_rgb_mode and you can operate on it as per the following examples. You write the file with a string in the format of six space separated numbers.

You can make changes to the color and program by writing a file in sysfs! The file is /sys/devices/platform/asus-nb-wmi/leds/asus::kbd_backlight/kbd_rgb_mode and you can operate on it as per the following examples. You write the file with a string in the format of six space separated numbers.

Source Link
Mark Paskal
  • 2.9k
  • 1
  • 25
  • 30

You can make changes to the color and program by writing a file in sysfs! The file is /sys/devices/platform/asus/sys/devices/platform/asus-nb-wmi/leds/asus::kbd_backlight/kbd_rgb_mode and you can operate on it as per the following examples. You write the file with a string in the format of six space separated numbers.

You can see the fields by running

cat /sys/devices/platform/asus/sys/devices/platform/asus-nb-wmi/leds/asus::kbd_backlight/kbd_rgb_mode_index

The first number is cmd, just set it to 0. I don't know that it does and the AI instructions I found omit it and do not work on my laptop.

The second number is mode which on my laptop can be as follows. I only checked up to 10.

Value   Mode        Description
0       Static      A single solid color.
1       Breathing   Fades the color in and out.
2       Color Cycle Loops through the entire RGB spectrum. Ignores the red green and blue fields.
9       Strobing    Flashes the color on and off.

Red, green, and blue are values between 0 and 255 that denote each color. So you would do 255 0 255 for purple or 255 0 0 for red. You can adjust the values to get the perfect color you want.

The final value is speed and can be 0 for slow, 1 for medium, or 2 for fast. This applies to the breathing, color cycle, and strobe effects.

Example for setting a static green color:

echo "0 0 0 255 0 0" | sudo tee /sys/devices/platform/asus-nb-wmi/leds/asus::kbd_backlight/kbd_rgb_mode

Example for setting a slow breathing purple color:

echo "0 1 255 0 255 0" | sudo tee /sys/devices/platform/asus-nb-wmi/leds/asus::kbd_backlight/kbd_rgb_mode

Example for setting a fast strobing white color:

echo "0 9 255 255 255 2" | sudo tee /sys/devices/platform/asus-nb-wmi/leds/asus::kbd_backlight/kbd_rgb_mode

Example for a slow color cycle (the default on my laptop):

echo "0 2 255 255 255 0" | sudo tee /sys/devices/platform/asus-nb-wmi/leds/asus::kbd_backlight/kbd_rgb_mode

In order to have your desired settings from boot you can make a systemd unit file to run the command.

Make a new file with nano:

sudo nano /etc/systemd/system/kbd-backlight-settings.service

Copy the following in and save with Ctrl + x and y

[Unit]
Description=Set keyboard backlight to SOLID GREEN (change the digits after echo below)
After=multi-user.target

[Service]
Type=oneshot
ExecStart=/bin/bash -c 'echo 0 0 0 255 0 0 | tee /sys/devices/platform/asus-nb-wmi/leds/asus::kbd_backlight/kbd_rgb_mode'
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target

Now enable it with the following and your settings will be applied at boot:

sudo systemctl enable --now kbd-backlight-settings.service