diff options
| author | Alexander Kassouni <alex@kassouni.net> | 2026-08-29 23:53:40 -0700 |
|---|---|---|
| committer | Alexander Kassouni <alex@kassouni.net> | 2026-08-29 23:53:40 -0700 |
| commit | af99b4960a9bf1043234354d685ed23818c14aaa (patch) | |
| tree | 9d6bd855c76c2c99e16321e1df4eeaadade28739 /users/kassouni/palette/kbd-backlight.nix | |
| parent | 8dcf355819cc6cd1e87924218c1adcd900ecda84 (diff) | |
new laptop
Diffstat (limited to 'users/kassouni/palette/kbd-backlight.nix')
| -rw-r--r-- | users/kassouni/palette/kbd-backlight.nix | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/users/kassouni/palette/kbd-backlight.nix b/users/kassouni/palette/kbd-backlight.nix new file mode 100644 index 0000000..9da0fb9 --- /dev/null +++ b/users/kassouni/palette/kbd-backlight.nix @@ -0,0 +1,20 @@ +{ pkgs, ... }: +{ + kassouni.palette.commands = [ + { + name = "toggle keyboard backlight"; + icon = ""; + # The leds sysfs node is group-writable by `video`, which kassouni is in, so + # this needs no root. Toggle between off and full rather than cycling levels. + exe = pkgs.writers.writeBash "kbd-backlight" '' + set -eu + dev=framework_laptop::kbd_backlight + if [ "$(${pkgs.brightnessctl}/bin/brightnessctl -d "$dev" get)" -gt 0 ]; then + ${pkgs.brightnessctl}/bin/brightnessctl -d "$dev" set 0 + else + ${pkgs.brightnessctl}/bin/brightnessctl -d "$dev" set 100% + fi + ''; + } + ]; +} |
