about summary refs log tree commit diff
path: root/modules/user/aszlig
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
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')
-rw-r--r--modules/user/aszlig/profiles/workstation/default.nix11
-rw-r--r--modules/user/aszlig/services/i3/default.nix4
2 files changed, 8 insertions, 7 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}
diff --git a/modules/user/aszlig/services/i3/default.nix b/modules/user/aszlig/services/i3/default.nix
index 9000efb3..34767e38 100644
--- a/modules/user/aszlig/services/i3/default.nix
+++ b/modules/user/aszlig/services/i3/default.nix
@@ -18,7 +18,7 @@ let
   wsPerHead = wsCount / headCount;
   excessWs = wsCount - (headCount * wsPerHead);
   headModifier = if cfg.reverseHeads then reverseList else id;
-  getHeadAt = elemAt (headModifier xrandrHeads);
+  getHeadAt = x: (elemAt (headModifier xrandrHeads) x).output;
 
   mkSwitchTo = number: "$mod+${if number == 10 then "0" else toString number}";
 
@@ -57,7 +57,7 @@ let
   '';
 
   barConfig = let
-    barHeads = headModifier xrandrHeads;
+    barHeads = map (h: h.output) (headModifier xrandrHeads);
     bars = if headCount == 0 then mkBar null conky.single
       else if headCount == 1 then mkBar (head barHeads) conky.single
       else let inner = take (length barHeads - 2) (tail barHeads);