AaronErhardt / tuxedo-rs

Rust libraries for interacting with hardware from TUXEDO Computers
GNU General Public License v2.0
138 stars 10 forks source link

Fix: properly handle monochrome devices #52

Closed SimonBrandner closed 9 months ago

SimonBrandner commented 9 months ago

Improves https://github.com/AaronErhardt/tuxedo-rs/issues/32


This PR fixes a bug where if one uses tailord with a device that doesn't support RGB, tailord would still default to an RGB profile which changes over time, this would then reset the keyboard backlight each time the user tried to change it manually.

The issue is fixed by making the default ColorProfile dependent on the LedControllerMode (i.e. its support of RGB)


Notes:

SimonBrandner commented 9 months ago

(for anyone interested in getting this running before it is merged: https://github.com/SimonBrandner/dotfiles/commit/f51ec63b3cabc09dd12161e8a925711cdddf4b70)

F3l1XQu1ll commented 9 months ago

Tested on nixos-unstable according to https://github.com/SimonBrandner/dotfiles/commit/f51ec63b3cabc09dd12161e8a925711cdddf4b70 Controlling the keyboard backlight on my InfinityBook Pro 16 Gen 8 now works like a charm with all three brightness levels using the keyboard shortcut as well as with the controls in GNOME (although the settings in GNOME don't reflect the current state of the backlight, but this seems to be a problem with GNOME)

SimonBrandner commented 9 months ago

Looks good except for the left over println!.

Oops :sweat_smile:

Also maybe the match statements over the find_map iterator could be simplified using unwrap_or_else.

New Rust feature for me - thanks for the pointer - I was hoping there'd be something like this!