Compare commits
5 Commits
cc89a7a0c4
...
c4b536f3cf
Author | SHA1 | Date |
---|---|---|
Zynh Ludwig | c4b536f3cf | |
Zynh Ludwig | 9b279a0b3c | |
Zynh Ludwig | a1903be803 | |
Zynh Ludwig | b9ee61bc0c | |
Zynh Ludwig | 353dc4fac3 |
|
@ -65,17 +65,24 @@ in
|
||||||
systemctl suspend
|
systemctl suspend
|
||||||
'')
|
'')
|
||||||
|
|
||||||
(writeShellScriptBin "tv-on" ''
|
(writeXrandrScriptBin "tv-on" {
|
||||||
xrandr \
|
DP-0 = {
|
||||||
--output DP-0 --primary --mode 1920x1080 --pos 1920x1080 --rotate normal \
|
primary = true;
|
||||||
--output HDMI-0 --mode 1920x1080 --pos 0x1080 --rotate normal \
|
mode = "1920x1080";
|
||||||
--output HDMI-1 --mode 1920x1080 --pos 1920x0 --rotate normal \
|
pos = "1920x1080";
|
||||||
--output DP-1 --off \
|
rotate = "normal";
|
||||||
--output DP-2 --off \
|
};
|
||||||
--output DP-3 --off \
|
HDMI-0 = {
|
||||||
--output DP-4 --off \
|
mode = "1920x1080";
|
||||||
--output DP-5 --off
|
pos = "0x1080";
|
||||||
'')
|
rotate = "normal";
|
||||||
|
};
|
||||||
|
HDMI-1 = {
|
||||||
|
mode = "1920x1080";
|
||||||
|
pos = "1920x0";
|
||||||
|
rotate = "normal";
|
||||||
|
};
|
||||||
|
})
|
||||||
|
|
||||||
feh
|
feh
|
||||||
imagemagick
|
imagemagick
|
||||||
|
|
|
@ -1,4 +1,8 @@
|
||||||
final: prev:
|
final: prev:
|
||||||
|
let
|
||||||
|
callDefaultPackage = path: prev.callPackage path { };
|
||||||
|
in
|
||||||
{
|
{
|
||||||
wrapWine = prev.lib.callPackage ./wrapWine.nix { };
|
wrapWine = callDefaultPackage ./wrapWine.nix;
|
||||||
|
writeXrandrScriptBin = callDefaultPackage ./writeXrandrScriptBin.nix;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
{ 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}
|
||||||
|
''
|
Loading…
Reference in New Issue