Compare commits

..

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

3 changed files with 12 additions and 50 deletions

View File

@ -65,24 +65,17 @@ in
systemctl suspend
'')
(writeXrandrScriptBin "tv-on" {
DP-0 = {
primary = true;
mode = "1920x1080";
pos = "1920x1080";
rotate = "normal";
};
HDMI-0 = {
mode = "1920x1080";
pos = "0x1080";
rotate = "normal";
};
HDMI-1 = {
mode = "1920x1080";
pos = "1920x0";
rotate = "normal";
};
})
(writeShellScriptBin "tv-on" ''
xrandr \
--output DP-0 --primary --mode 1920x1080 --pos 1920x1080 --rotate normal \
--output HDMI-0 --mode 1920x1080 --pos 0x1080 --rotate normal \
--output HDMI-1 --mode 1920x1080 --pos 1920x0 --rotate normal \
--output DP-1 --off \
--output DP-2 --off \
--output DP-3 --off \
--output DP-4 --off \
--output DP-5 --off
'')
feh
imagemagick

View File

@ -1,8 +1,4 @@
final: prev:
let
callDefaultPackage = path: prev.callPackage path { };
in
{
wrapWine = callDefaultPackage ./wrapWine.nix;
writeXrandrScriptBin = callDefaultPackage ./writeXrandrScriptBin.nix;
wrapWine = prev.lib.callPackage ./wrapWine.nix { };
}

View File

@ -1,27 +0,0 @@
{ lib, writeShellScriptBin }:
let
inherit (builtins) getAttr hasAttr isAttrs concatStringsSep;
inherit (lib) assertMsg lists escapeShellArgs;
inherit (lib.attrsets) mapAttrsToList;
inherit (lib.cli) toGNUCommandLine;
in
name: config:
assert assertMsg (isAttrs config)
"config should be an attrs, found ${lib.typeOf config}";
let
isPrimary = config:
(hasAttr "primary" config) && (getAttr "primary" config);
getArgList = output: config:
(escapeShellArgs (lists.flatten [
(toGNUCommandLine { } { "--output" = output; })
(lists.optional (isPrimary config) "--primary")
(toGNUCommandLine { } config)
]));
args = mapAttrsToList getArgList config;
in
writeShellScriptBin name ''
xrandr \
${concatStringsSep " \\\n " args}
''