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, ... }: { pkgs, ... }:
{ {
services.screen-locker = { services.screen-locker = {
enable = false; enable = true;
lockCmd = "${pkgs.lockscreen}"; lockCmd = "${pkgs.lockscreen}/bin/lockscreen";
inactiveInterval = 10; # miutes 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`"; "{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}"; "XF86Audio{Next,Play,Prev}" = "playerctl {next,play-pause,previous}";
"super + alt + {Right,Down,Left}" = "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"; "Print" = "gnome-screenshot -i";
}; };
}; };

View file

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