From 8cee271d91369119509481cc1adf28e71c5744cb Mon Sep 17 00:00:00 2001 From: Julian Mutter Date: Wed, 19 Jun 2024 23:42:33 +0200 Subject: [PATCH] Improve / fix screen lock and brightness buttons --- modules/home/i3/default.nix | 4 ++++ modules/home/i3/i3/config | 6 +++--- systems/x86_64-linux/aspi/default.nix | 17 +++++++++++++++++ 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/modules/home/i3/default.nix b/modules/home/i3/default.nix index a5696f2..86109f7 100644 --- a/modules/home/i3/default.nix +++ b/modules/home/i3/default.nix @@ -45,6 +45,10 @@ in xfce.xfce4-screenshooter ]; xsession.enable = true; # Give gui programs access to sessionVariables + # Prevent screen from going blank + xsession.initExtra = '' + ${pkgs.xorg.xset}/bin/xset s off + ''; xsession.windowManager.i3 = { enable = true; package = pkgs.i3-gaps; diff --git a/modules/home/i3/i3/config b/modules/home/i3/i3/config index 783934f..4f9059c 100644 --- a/modules/home/i3/i3/config +++ b/modules/home/i3/i3/config @@ -11,11 +11,11 @@ font pango:FuraCode Nerd Font 12 # xss-lock grabs a logind suspend inhibit lock and will use $lock to lock the # screen before suspend. Use loginctl lock-session to lock your screen. -exec --no-startup-id xss-lock --transfer-sleep-lock -- $lock --nofork +# exec --no-startup-id xss-lock --transfer-sleep-lock -- $lock --nofork # Screen brightness controls -# bindsym XF86MonBrightnessUp exec "xbacklight -inc 10; notify-send 'brightness up'" -# bindsym XF86MonBrightnessDown exec "xbacklight -dec 10; notify-send 'brightness down'" +bindsym XF86MonBrightnessUp exec "brightnessctl set 5%+" +bindsym XF86MonBrightnessDown exec "brightnessctl set 5%-" # Use pactl to adjust volume in PulseAudio. # set $refresh_i3status killall -SIGUSR1 i3status diff --git a/systems/x86_64-linux/aspi/default.nix b/systems/x86_64-linux/aspi/default.nix index bf93d7d..4afe7bd 100644 --- a/systems/x86_64-linux/aspi/default.nix +++ b/systems/x86_64-linux/aspi/default.nix @@ -118,6 +118,21 @@ services.xserver.windowManager.i3.package = pkgs.i3-gaps; services.blueman.enable = true; + services.upower.enable = true; + + # TODO: move into i3 module + programs.xss-lock = { + # responds to "loginctl lock-session" via dbus + enable = true; + lockerCommand = "${pkgs.i3lock}/bin/i3lock --ignore-empty-password --color=000000"; + }; + # services.xserver.xautolock = { # TODO: does not work + # enable = true; + # time = 1; + # }; + programs.dconf.enable = true; + services.logind.lidSwitch = "lock"; + services.logind.lidSwitchDocked = "lock"; programs.kdeconnect.enable = true; @@ -263,6 +278,8 @@ frajul.pulseaudio-popup gparted-xhost # needs to be installed as system package so it can be actually opened xclip + + brightnessctl ]; virtualisation.docker.enable = true;