Compare commits

..

No commits in common. "21f82ed50625e60e1d963c461625c5225cd52457" and "c4b536f3cf7b47742e6097a7de2bf0a07d1c4668" have entirely different histories.

4 changed files with 17 additions and 20 deletions

View File

@ -50,20 +50,17 @@
systemd.user.services.screenlayout = {
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";
};
});
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
'';
wantedBy = [ "graphical-session.target" ];
partOf = [ "graphical-session.target" ];
};

View File

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

View File

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