Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keyboard color #3

Open
junocomp opened this issue Jul 12, 2022 · 6 comments
Open

Keyboard color #3

junocomp opened this issue Jul 12, 2022 · 6 comments

Comments

@junocomp
Copy link

How do I set the entire keyboard to one color instead per key?

@allan-null
Copy link

allan-null commented Mar 23, 2023

With a bash script

brightness=4
red=148
green=0
blue=211
cfg="reset\nbrightness $brightness\n"
key=180
for (( i=0; i<=$key; i++ ))
do
    cfg="${cfg}led $i $red $green $blue\n"
done

sudo /home/allan/.local/bin/ite-829x << LEDs
    $(echo -e $cfg)
LEDs

@matheusmoreira matheusmoreira pinned this issue Mar 23, 2023
@matheusmoreira
Copy link
Owner

The bash script is an excellent solution!

I'd like to note that the LED codes are not continuous from 0 to 180, there are some gaps that are apparently unmapped. Sending those commands to the keyboard apparently does nothing so it's probably fine. I have no way to guarantee that though.

Here are the LED codes I obtained from my keyboard:

  0 - 19 	Escape -> PageDown
 32 - 43 	Tilde -> Minus
 45 - 51 	Equals -> KeypadMinus
 64 - 83 	Tab1 -> KeypadPlus1
 96 - 108	CapsLock1 -> SingleQuote
110 - 115	Enter1 -> KeypadPlus2
128      	Shift1
130 - 147	Shift2 -> KeypadEnter1
160 - 165	Ctrl1 -> Spacebar1
169 - 179	Spacebar2 -> KeypadEnter2

102 keys.
114 LEDs.

Bash arrays would be a nice solution. Sequence expansion can be used to populate the array.

declare -a LEDs
LEDs=({0..19} {32..43} {45..51} {64..83} {96..108} {110..115} 128 {130..147} {160..165} {169..179})

cfg="reset\nbrightness $brightness\n"

for LED in "${LEDs[@]}"; do
  cfg="${cfg}led ${LED} ${red} ${green} ${blue}\n"
done

@allan-null
Copy link

I didn't even know you could declare arrays like that in bash. I will definitely improve my script, thank you!

You know, at some point I had a bash script using Zenity to create a GUI for your driver, but then I spilled coffee on my laptop and the script was gone. But my laptop is back and I will definitely rewrite an UI for it.

@matheusmoreira
Copy link
Owner

@allan-null That's frickin' awesome. When I published this project I never thought I'd have users, let alone other developers building on top of it.

I'd be happy to accept patches if you'd like to contribute. Truth is I develop on my smartphone with Termux now. Haven't used my laptop in a while. This is why I haven't been maintaining this.

@junocomp
Copy link
Author

@allan-null You should post it when you have made the GUI app, that would be great

@allan-null
Copy link

@junocomp @matheusmoreira There are a few bugs, but it's mostly ready https://github.com/allan-null/ite-829x-ui

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants