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

View File

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

View File

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