Auto brightness + dunst notification

This commit is contained in:
Filippo Berto 2022-08-16 19:48:57 +02:00
parent 6d5925d6a5
commit 4befb01e03
3 changed files with 14 additions and 21 deletions

View file

@ -1,8 +1,12 @@
{ pkgs, ... }:
{
services.screen-locker = {
enable = false;
lockCmd = "${pkgs.lockscreen}";
inactiveInterval = 10; # miutes
enable = true;
lockCmd = "${pkgs.lockscreen}/bin/lockscreen";
inactiveInterval = 2; # minutes
xautolock.extraOptions = [
"-secure"
"-lockaftersleep"
];
};
}

View file

@ -55,7 +55,7 @@
"{XF86AudioLowerVolume,XF86AudioMute,XF86AudioRaiseVolume}" = "pamixer {-d 2 -u,-t,-i 2 -u} && dunstify -r 1 Volume `pamixer --get-volume-human`";
"XF86Audio{Next,Play,Prev}" = "playerctl {next,play-pause,previous}";
"super + alt + {Right,Down,Left}" = "playerctl {next,play-pause,previous}";
"XF86MonBrightness{Up,Down}" = "xbacklight {+,-}10%";
"XF86MonBrightness{Up,Down}" = ''xbacklight -{inc,dec} 10 && dunstify -r 2 Luminosità `printf "%.0f" $(xbacklight -get)`'';
"Print" = "gnome-screenshot -i";
};
};

View file

@ -3,31 +3,20 @@
with lib;
let
xscreensaverCmd = "${pkgs.xscreensaver}/bin/xscreensaver-command -activate";
lockCmd = "${pkgs.lockscreen}/bin/lockscreen";
xbacklightCmd = "${pkgs.xorg.xbacklight}/bin/xbacklight";
lightLevel = 10;
in
{
services.xidlehook = {
enable = true;
# not-when-audio = false;
not-when-audio = true;
not-when-fullscreen = true;
timers = [
{
command = lockCmd;
delay = 300;
}
{
command = xscreensaverCmd;
delay = 120;
command = "${xbacklightCmd} -get > /tmp/xbacklight_v && ${xbacklightCmd} -set ${toString lightLevel}";
canceller = "${xbacklightCmd} -set $(cat /tmp/xbacklight_v || echo 100)";
delay = 30;
}
];
};
services.xscreensaver = {
enable = true;
settings = {
mode = "blank";
fadeTicks = 20;
lock = false;
};
};
}