summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--modules/laptop.nix32
1 files changed, 32 insertions, 0 deletions
diff --git a/modules/laptop.nix b/modules/laptop.nix
index 17acb381..ea6b9c6e 100644
--- a/modules/laptop.nix
+++ b/modules/laptop.nix
@@ -12,8 +12,34 @@
   environment.systemPackages = with pkgs; [
     powerstat
     powertop
+
+    arandr
+    autorandr
+    disper
   ];
 
+  # powerManagement.resumeCommands = ''
+  #   AUTORANDR="autorandr -c"
+
+  #   detect_display()
+  #   {
+  #     for X in /tmp/.X11-unix/X*; do
+  #       D="''${X##/tmp/.X11-unix/X}"
+  #       user=$(who | awk -vD="$D" '$5 ~ "\\(:"D"\\)$" {print $1}')
+  #       if [ x"$user" != x"" ]; then
+  #         export DISPLAY=":$D"
+  #         /bin/su -c "''${AUTORANDR}" "$user"
+  #       fi
+  #     done
+  #   }
+
+  #   case "$1" in
+  #     thaw|resume)
+  #       detect_display
+  #       ;;
+  #   esac
+  # '';
+
   programs.light.enable = true;
 
   services.logind.extraConfig = ''
@@ -21,6 +47,8 @@
     IdleActionSec=600
   '';
 
+  services.physlock.enable = true;
+
   services.tlp = {
     enable = true;
     extraConfig = ''
@@ -28,6 +56,10 @@
     '';
   };
 
+  services.udev.extraRules = ''
+    # ACTION=="change", SUBSYSTEM=="drm", ENV{DISPLAY}=":0", ENV{XAUTHORITY}="/home/alan/.Xauthority", RUN+="${pkgs.autorandr}/bin/autorandr -c"
+  '';
+
   services.xserver = {
     libinput = {
       enable = true;