Compare commits

...

4 Commits

4 changed files with 20 additions and 17 deletions

View File

@ -50,17 +50,20 @@
systemd.user.services.screenlayout = {
script = ''
${pkgs.xorg.xrandr}/bin/xrandr \
--output DP-0 --primary --mode 1920x1080 --pos 1920x0 --rotate normal \
--output HDMI-0 --mode 1920x1080 --pos 0x0 --rotate normal \
--output DP-1 --off \
--output DP-2 --off \
--output DP-3 --off \
--output DP-4 --off \
--output DP-5 --off \
--output HDMI-1 --off
'';
script = lib.getExe
(pkgs.writeXrandrScriptBin "default-monitors" {
DP-0 = {
primary = true;
mode = "1920x1080";
pos = "1920x0";
rotate = "normal";
};
HDMI-0 = {
mode = "1920x1080";
pos = "0x0";
rotate = "normal";
};
});
wantedBy = [ "graphical-session.target" ];
partOf = [ "graphical-session.target" ];
};

View File

@ -3,6 +3,6 @@ let
callDefaultPackage = path: prev.callPackage path { };
in
{
wrapWine = callDefaultPackage ./wrapWine.nix;
writeXrandrScriptBin = callDefaultPackage ./writeXrandrScriptBin.nix;
wrapWine = callDefaultPackage ./wrapWine;
writeXrandrScriptBin = callDefaultPackage ./writeXrandrScriptBin;
}

View File

@ -1,7 +1,7 @@
{ lib, writeShellScriptBin }:
{ lib, writeShellScriptBin, xrandr }:
let
inherit (builtins) getAttr hasAttr isAttrs concatStringsSep;
inherit (lib) assertMsg lists escapeShellArgs;
inherit (lib) assertMsg lists escapeShellArgs getExe;
inherit (lib.attrsets) mapAttrsToList;
inherit (lib.cli) toGNUCommandLine;
in
@ -14,7 +14,7 @@ let
getArgList = output: config:
(escapeShellArgs (lists.flatten [
(toGNUCommandLine { } { "--output" = output; })
(toGNUCommandLine { } { inherit output; })
(lists.optional (isPrimary config) "--primary")
(toGNUCommandLine { } config)
]));
@ -22,6 +22,6 @@ let
args = mapAttrsToList getArgList config;
in
writeShellScriptBin name ''
xrandr \
${getExe xrandr} \
${concatStringsSep " \\\n " args}
''