From f1a49dcee9df5c96ec5c261373c43c6da70701e4 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 9 Sep 2017 15:51:54 +0200 Subject: laptop: Add multi-display setup --- modules/laptop.nix | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'modules/laptop.nix') 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; -- cgit 1.4.1