nix-setup/bright.script.nix
2024-09-07 01:18:31 +02:00

13 lines
260 B
Nix

with import <nixpkgs> {};
pkgs.writeShellScriptBin "bright" ''
#!/bin/sh
f="/sys/class/backlight/*/brightness"
if [ "$1" = up ] ; then
echo $(($(cat $f) + 50)) | sudo tee $f
fi
if [ "$1" = down ] ; then
echo $(($(cat $f) - 50)) | sudo tee $f
fi
''