fe508d9cd8
Hyprland - Switch wayland.windowManager.hyprland to configType = "lua" (Hyprland 0.56) - Convert settings, env, monitors, window rules, gesture, animations (hl.curve/hl.animation) and all keybinds to hl.* calls - Add home/system/hyprland/lib.nix with exec/bind/execOnce helpers; every exec-once now runs from a hyprland.start hook - Drop hard-coded default_monitor = "eDP-2" Flake - Remove blog, awesome-wallpapers and default-creds inputs (their repos no longer ship a flake.nix and broke `nix flake update`), along with the server modules and Glance links that used them - Update flake.lock - Replace removed `gcr` with `gcr_4` Fixes - Point configDirectory at /etc/nixos/nixy on home-pc and thinkpad - Fix home-pc git email typo - Remove conflicting openpgp signing format, make pull.rebase a boolean, replace hx/peco in git aliases with nvim/sk - Fix zsh NUL alias (2>&1) and stop forcing bat colors in the cat alias - Require a password for sudo again (nixos-rebuild stays NOPASSWD) - Remove duplicate hardware.graphics block from home-pc flake - Delete unused zen .old files, run alejandra on host files
47 lines
1.5 KiB
Nix
47 lines
1.5 KiB
Nix
# Turn the keyboard red/off when the battery is low
|
|
# Include this one only if you have a omen laptop with RGB keyboard
|
|
{
|
|
pkgs,
|
|
config,
|
|
lib,
|
|
...
|
|
}: let
|
|
hl = import ./lib.nix {inherit lib;};
|
|
alert-when-low-battery = false;
|
|
keyboard-backlight = pkgs.writeShellScriptBin "keyboard-backlight" ''
|
|
function set_keyboard_backlight {
|
|
local color=$1
|
|
echo $color > /sys/devices/platform/hp-wmi/rgb_zones/zone00
|
|
echo $color > /sys/devices/platform/hp-wmi/rgb_zones/zone01
|
|
echo $color > /sys/devices/platform/hp-wmi/rgb_zones/zone02
|
|
echo $color > /sys/devices/platform/hp-wmi/rgb_zones/zone03
|
|
}
|
|
state="white"
|
|
set_keyboard_backlight ${config.lib.stylix.colors.base0D}
|
|
if [ "${toString alert-when-low-battery}" = "false" ]; then
|
|
exit 0
|
|
fi
|
|
while true; do
|
|
BATTERY_LEVEL=$(cat /sys/class/power_supply/BAT*/capacity)
|
|
IS_CHARGING=$(cat /sys/class/power_supply/BAT*/status)
|
|
if [[ $BATTERY_LEVEL -le 10 && $IS_CHARGING != "Charging" ]]; then
|
|
if [[ $state == "red" ]];then
|
|
state="white"
|
|
set_keyboard_backlight "000000"
|
|
else
|
|
state="red"
|
|
set_keyboard_backlight "FF0000"
|
|
fi
|
|
else
|
|
state="white"
|
|
set_keyboard_backlight ${config.lib.stylix.colors.base0D}
|
|
fi
|
|
sleep 2
|
|
done
|
|
'';
|
|
|
|
command = "bash ${keyboard-backlight}/bin/keyboard-backlight &";
|
|
in {
|
|
wayland.windowManager.hyprland.settings.on = hl.execOnce [command];
|
|
}
|