~ruther/nixos-config

2ee75c629cdb30b994e36c9abff4e82621e00c73 — Frantisek Bohacek 1 year, 6 months ago 8f34e84
feat(laptop): add brightness program and adjustment in qtile
M hosts/laptop/default.nix => hosts/laptop/default.nix +2 -2
@@ 59,8 59,8 @@

  networking.networkmanager.enable = true;

  programs = {                              # No xbacklight, this is the alterantive
    light.enable = true;
  hardware = {                              # No xbacklight, this is the alterantive
    brillo.enable = true;
  };

  services = {

A modules/desktop/qtile/config/brightness.sh => modules/desktop/qtile/config/brightness.sh +17 -0
@@ 0,0 1,17 @@
#!/usr/bin/env sh

function send_notification() {
    brightness=$(printf "%.0f\n" $(brillo -G))
    dunstify -a "brightness" -u low -r 9991 -h int:value:"$brightness" -i "brightness-$1" "Brightness: $brightness %"
}

case $1 in
    up)
        brillo -A 5 -q
        ;;
    down)
        brillo -U 5 -q -c 2
        ;;
esac

send_notification $1

M modules/desktop/qtile/config/config.py => modules/desktop/qtile/config/config.py +2 -2
@@ 415,8 415,8 @@ keys.extend([
    EzKey('<XF86AudioNext>', lazy.spawn(f'{sequenceDetectorExec} -g mpris next')),
    EzKey('<XF86AudioPrev>', lazy.spawn(f'{sequenceDetectorExec} -g mpris prev')),
    EzKey('<XF86AudioMute>', lazy.spawn('amixer -D pulse set Master 1+ toggle')),
    EzKey('<XF86MonBrightnessUp>', lazy.spawn('xbacklight -inc 5')),
    EzKey('<XF86MonBrightnessDown>', lazy.spawn('xbacklight -dec 5')),
    EzKey('<XF86MonBrightnessUp>', lazy.spawn(f'{configLocation}/brightness.sh up')),
    EzKey('<XF86MonBrightnessDown>', lazy.spawn(f'{configLocation}/brightness.sh down')),
])

# Printscreen

Do not follow this link