From 2770e7c086711fdb410d41634d18a7c09397951e Mon Sep 17 00:00:00 2001 From: Luke Granger-Brown Date: Sat, 8 Jan 2022 22:17:13 +0000 Subject: [PATCH] porcorosso: tweak setup-display so that it overrides panning --- ops/nixos/porcorosso/default.nix | 29 ++++++++++++------- .../modules/programs/autorandr.nix | 8 +++++ 2 files changed, 27 insertions(+), 10 deletions(-) diff --git a/ops/nixos/porcorosso/default.nix b/ops/nixos/porcorosso/default.nix index 6019efda5d..dd21613e06 100644 --- a/ops/nixos/porcorosso/default.nix +++ b/ops/nixos/porcorosso/default.nix @@ -15,6 +15,12 @@ let (nvidia-offload-profile + '' exec -a "$0" "$@" ''); + + setup-display = pkgs.writeShellScriptBin "setup-display-porcorosso" '' + ${pkgs.xorg.xrandr}/bin/xrandr --setprovideroutputsource modesetting NVIDIA-0 + ${pkgs.xorg.xrandr}/bin/xrandr --auto + ${pkgs.autorandr}/bin/autorandr -c + ''; in { imports = [ ../lib/zfs.nix @@ -188,14 +194,8 @@ in { extraGroups = [ "wheel" "networkmanager" "libvirtd" "lxd" "video" ]; }; my.home-manager.system = {...}: { - xsession.windowManager.i3.config.startup = let - setupDisplay = pkgs.writeShellScriptBin "setup-display-porcorosso" '' - ${pkgs.xorg.xrandr}/bin/xrandr --setprovideroutputsource modesetting NVIDIA-0 - ${pkgs.xorg.xrandr}/bin/xrandr --auto - ${pkgs.autorandr}/bin/autorandr -c - ''; - in lib.mkAfter [ - { command = "${setupDisplay}/bin/setup-display-porcorosso"; notification = false; } + xsession.windowManager.i3.config.startup = lib.mkAfter [ + { command = "${setup-display}/bin/setup-display-porcorosso"; notification = false; } ]; programs.autorandr = { enable = true; @@ -206,21 +206,29 @@ in { mode = "1920x1080"; position = "0x0"; rate = "59.98"; + transform = [ + [ 2.0 0.0 0.0 ] + [ 0.0 2.0 0.0 ] + [ 0.0 0.0 1.0 ] + ]; + panning = "3840x2160+0+0"; crtc = 4; }; "DP-0.2" = { enable = true; mode = "3840x2160"; primary = true; - position = "1920x0"; + position = "3840x0"; rate = "60.00"; + panning = "3840x2160+3840+0"; crtc = 1; }; "DP-0.1" = { enable = true; mode = "3840x2160"; - position = "5760x0"; + position = "7680x0"; rate = "60.00"; + panning = "3840x2160+7680+0"; crtc = 0; }; }; @@ -251,6 +259,7 @@ in { iw obs-studio vulkan-tools + setup-display ]); }; diff --git a/third_party/home-manager/modules/programs/autorandr.nix b/third_party/home-manager/modules/programs/autorandr.nix index 69505f2552..359795e85d 100644 --- a/third_party/home-manager/modules/programs/autorandr.nix +++ b/third_party/home-manager/modules/programs/autorandr.nix @@ -89,6 +89,13 @@ let example = "60.00"; }; + panning = mkOption { + type = types.str; + description = "X11 panning specification ([width]x[height]+[x]+[y])."; + default = ""; + example = "3840x2160+0+0"; + }; + gamma = mkOption { type = types.str; description = "Output gamma configuration."; @@ -259,6 +266,7 @@ let ++ optional (config.dpi != null) "dpi ${toString config.dpi}" ++ optional (config.gamma != "") "gamma ${config.gamma}" ++ optional (config.mode != "") "mode ${config.mode}" + ++ optional (config.panning != "") "panning ${config.panning}" ++ optional (config.rate != "") "rate ${config.rate}" ++ optional (config.rotate != null) "rotate ${config.rotate}" ++ optional (config.transform != null) ("transform "