about summary refs log tree commit diff
path: root/modules/user/aszlig/profiles/workstation/default.nix
diff options
context:
space:
mode:
authoraszlig <aszlig@redmoonstudios.org>2017-06-18 02:09:33 +0200
committeraszlig <aszlig@redmoonstudios.org>2017-06-18 02:24:02 +0200
commit1e4d169795a65be418cd53cb475cc8774b502f0a (patch)
tree71dc91c97c853f87ccb434183851fba940df717d /modules/user/aszlig/profiles/workstation/default.nix
parent37143b3fa7b54026d0d55279c5bdb80747443dbf (diff)
modules/aszlig: Cope with new xrandrHeads options
The way xrandrHeads are addressed has changed with the following
upstream merge commit:

  NixOS/nixpkgs@9dca737d6269759745c9e68ea462446cde4d9be9

Now xrandrHeads are no longer a list of strings but a list of attribute
sets, but we new do have even more information about a particular head.

So apart from fixing this, we new also set --primary whenever applicable
in "xreset".

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
Diffstat (limited to 'modules/user/aszlig/profiles/workstation/default.nix')
-rw-r--r--modules/user/aszlig/profiles/workstation/default.nix11
1 files changed, 6 insertions, 5 deletions
diff --git a/modules/user/aszlig/profiles/workstation/default.nix b/modules/user/aszlig/profiles/workstation/default.nix
index 34b08731..05b830fd 100644
--- a/modules/user/aszlig/profiles/workstation/default.nix
+++ b/modules/user/aszlig/profiles/workstation/default.nix
@@ -2,7 +2,7 @@
 
 let
   cfg = config.vuizvui.user.aszlig.profiles.workstation;
-  randrHeads = config.services.xserver.xrandrHeads;
+  inherit (config.services.xserver) xrandrHeads;
 
 in {
   options.vuizvui.user.aszlig.profiles.workstation = {
@@ -16,12 +16,13 @@ in {
     boot.cleanTmpDir = true;
 
     environment.systemPackages = with lib; let
-      mkRandrConf = acc: name: acc ++ singleton {
-        inherit name;
-        value = "--output '${name}' --preferred"
+      mkRandrConf = acc: rcfg: acc ++ singleton {
+        name = rcfg.output;
+        value = "--output ${lib.escapeShellArg rcfg.output} --preferred"
+              + optionalString rcfg.primary " --primary"
               + optionalString (acc != []) " --right-of '${(head acc).name}'";
       };
-      randrConf = map (getAttr "value") (foldl mkRandrConf [] randrHeads);
+      randrConf = map (getAttr "value") (foldl mkRandrConf [] xrandrHeads);
     in singleton (pkgs.writeScriptBin "xreset" ''
       #!${pkgs.stdenv.shell}
       ${pkgs.xorg.xrandr}/bin/xrandr ${concatStringsSep " " randrConf}