This repository will no longer get any updates as the code here is now part of tuxedo-drivers https://gitlab.com/tuxedocomputers/development/packages/tuxedo-drivers.
Actually this isn't a question for help, but already an answer for those, who try to figure out how to do this. Below you can find some bash commands to apply various colors to definable keys backlight.
TLDR: see section COMMANDS below
First look if tuxedo-keyboard is installed correctly:
Maybe you have to install tuxedo-control-center, too, to make everything work. In every case you need to reboot after installing the modules. The next command should give a long list of directories with the following name
syntax, where # is a number from 1 to 119 (or even 126):
ls /sys/class/leds/ | grep rgb
Output:
...
rgb:kbd_backlight_#
...
If so, good. If not, the driver is probably not working correctly. You may have to remove and reinstall it.
Every single of those directories stands for one single LED triplet (here shortened: tripLED)
underneath your keyboard keys, except for some, that don't. The latter are just there to fill the gaps to have a more or less consistent row and column numbering scheme, I guess.
There is one directory without '_#' suffix, which is the ESC-key in my case, but if you'd ask me, it should have suffix '_0' to have it consistent.
Here follows the numbering scheme for my 17" notebook keyboard with a numblock and scroll keys above, where [# #] stands for 'grouped under the same key':
numbers without counterpart are in my case:
0, 32, 55, 73, 81, 106..108
The content of one directory should look like this:
# ls /sys/class/leds/rgb:kbd_backlight_1/
brightness device max_brightness multi_index multi_intensity power
subsystem trigger uevent
The only two/three files of interest are:
multi_intensity
brightness
(max_brightness)
max_brightness
stores a single number which gives the maximum number to
be set in 'brightness'. I wouldn't change this.
Default: 10
multi_intensity
stores the RGB value in three decimal numbers from 0 to 255,
seperated by a single space.
Default: 0 0 255
And finally
THE COMMANDS
Here follows a list of possible commands to permanently change the color of the keyboard's backlights. NOTE: your key mapping might be different. If the commands are not working like expected you have to figure out your personal mapping by trial and error with the second command.
1. Changing the whole keyboards backlight color at once:
echo '0 150 255' | sudo tee /sys/class/leds/rgb:kbd_backlight*/multi_intensity
2. Changing a single tripLED's/key's color (two examples):
echo '255 0 155' | sudo tee /sys/class/leds/rgb:kbd_backlight_15/multi_intensity
echo '255 0 155' | sudo tee /sys/class/leds/rgb:kbd_backlight/multi_intensity
Your DEL and ESC keys should be pink now.
3. Applying a blueish green to all the function keys and the Fn key:
for i in {1..12} 102;do echo '0 255 80' | sudo tee /sys/class/leds/rgb:kbd_backlight_$i/multi_intensity; done
4. Color the num block and keys above in yellow (two examples):
for i in {16..19} {36..39} {56..59} {76..79} {96..99} {117..119};do echo '255 150 0' | sudo tee /sys/class/leds/rgb:kbd_backlight_$i/multi_intensity; done
for i in {16..96..20} {17..117..20} {18..118..20} {19..119..20};do echo '255 150 0' | sudo tee /sys/class/leds/rgb:kbd_backlight_$i/multi_intensity; done
5. Color the arrow keys in the same green like the function keys in step 3:
for i in 95 {114..116};do echo '0 255 80' | sudo tee /sys/class/leds/rgb:kbd_backlight_$i/multi_intensity; done
6. Applying random colors to every second key (including the ESC key):
for i in {2..119..2} '\b*';do echo `shuf -i 0-255 -n 3` | sudo tee /sys/class/leds/rgb:kbd_backlight_$i/multi_intensity; done
NOTE the accents `` around the 'shuf' command, which return the output of the code inside executed in a sub-shell.
7. Applying a color gradient to the function keys:
for i in {1..12};do echo $(((i-1)*22)) $(((12-i)*14)) $(((12-i)*9+156)) | sudo tee /sys/class/leds/rgb\:kbd_backlight_$i/multi_intensity; done
complete template script
If you put steps 1 to 5 in an executable script, you'd have some kind of layout template to work with. Sometimes you have to reactivate it. For me suspend deactivates backlight at all and I have to run the script again.
#!/bin/bash
# keyboard backlight script by def-user
# all keys
echo '0 150 255' | sudo tee /sys/class/leds/rgb:kbd_backlight*/multi_intensity
# DEL key
echo '255 0 155' | sudo tee /sys/class/leds/rgb:kbd_backlight_15/multi_intensity
# ESC key
echo '255 0 155' | sudo tee /sys/class/leds/rgb:kbd_backlight/multi_intensity
# function and Fn keys
for i in {1..12} 102;
do
echo '0 255 80' | sudo tee /sys/class/leds/rgb:kbd_backlight_$i/multi_intensity
done
# complete numblock and keys above
for i in {16..19} {36..39} {56..59} {76..79} {96..99} {117..119};
do
echo '255 150 0' | sudo tee /sys/class/leds/rgb:kbd_backlight_$i/multi_intensity
done
# arrow keys
for i in 95 {114..116};
do
echo '0 255 80' | sudo tee /sys/class/leds/rgb:kbd_backlight_$i/multi_intensity
done
You may want to alter the first line and put in the path to your bash install given by:
which bash
Don't forget to make it executable via:
chmod u+x keyboard_backlight_layout.sh
The changes should be persistent through reboots, so there is no need to autostart the script.
Actually this isn't a question for help, but already an answer for those, who try to figure out how to do this. Below you can find some bash commands to apply various colors to definable keys backlight. TLDR: see section COMMANDS below
First look if
tuxedo-keyboard
is installed correctly:The output should look like this:
Maybe you have to install
tuxedo-control-center
, too, to make everything work. In every case you need to reboot after installing the modules. The next command should give a long list of directories with the following name syntax, where # is a number from 1 to 119 (or even 126):Output:
If so, good. If not, the driver is probably not working correctly. You may have to remove and reinstall it. Every single of those directories stands for one single LED triplet (here shortened: tripLED) underneath your keyboard keys, except for some, that don't. The latter are just there to fill the gaps to have a more or less consistent row and column numbering scheme, I guess. There is one directory without '_#' suffix, which is the ESC-key in my case, but if you'd ask me, it should have suffix '_0' to have it consistent.
Here follows the numbering scheme for my 17" notebook keyboard with a numblock and scroll keys above, where [# #] stands for 'grouped under the same key':
numbers without counterpart are in my case: 0, 32, 55, 73, 81, 106..108
The content of one directory should look like this:
The only two/three files of interest are:
max_brightness
stores a single number which gives the maximum number to be set in 'brightness'. I wouldn't change this. Default:
10
multi_intensity
stores the RGB value in three decimal numbers from 0 to 255, seperated by a single space. Default:
0 0 255
And finally
THE COMMANDS
Here follows a list of possible commands to permanently change the color of the keyboard's backlights. NOTE: your key mapping might be different. If the commands are not working like expected you have to figure out your personal mapping by trial and error with the second command.
1. Changing the whole keyboards backlight color at once:
2. Changing a single tripLED's/key's color (two examples):
Your DEL and ESC keys should be pink now.
3. Applying a blueish green to all the function keys and the Fn key:
4. Color the num block and keys above in yellow (two examples):
5. Color the arrow keys in the same green like the function keys in step 3:
6. Applying random colors to every second key (including the ESC key):
NOTE the accents `` around the 'shuf' command, which return the output of the code inside executed in a sub-shell.
7. Applying a color gradient to the function keys:
complete template script
If you put steps 1 to 5 in an executable script, you'd have some kind of layout template to work with. Sometimes you have to reactivate it. For me suspend deactivates backlight at all and I have to run the script again.
You may want to alter the first line and put in the path to your bash install given by:
Don't forget to make it executable via:
The changes should be persistent through reboots, so there is no need to autostart the script.