summary refs log tree commit diff stats
path: root/modules
diff options
context:
space:
mode:
authorAlan Pearce2017-09-09 15:51:54 +0200
committerAlan Pearce2017-09-09 16:49:30 +0200
commitf1a49dcee9df5c96ec5c261373c43c6da70701e4 (patch)
tree5b968dc176a615a5e248c417278d72444b0057f0 /modules
parent5e68b39af8a46a0a9c68b57aa84d8689e06be1ed (diff)
downloadnixos-configuration-f1a49dcee9df5c96ec5c261373c43c6da70701e4.tar.lz
nixos-configuration-f1a49dcee9df5c96ec5c261373c43c6da70701e4.tar.zst
nixos-configuration-f1a49dcee9df5c96ec5c261373c43c6da70701e4.zip
laptop: Add multi-display setup
Diffstat (limited to 'modules')
-rw-r--r--modules/laptop.nix32
1 files changed, 32 insertions, 0 deletions
diff --git a/modules/laptop.nix b/modules/laptop.nix
index 17acb38..ea6b9c6 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;