From 970b57fd3c93f6c76d5cdfb4da23a5b4010b9e8b Mon Sep 17 00:00:00 2001 From: Kylie McClain Date: Thu, 17 Mar 2022 08:45:04 -0400 Subject: [PATCH] autorandr: add filter option (#2795) xrandr's filter option is useful for enabling integer scaling on displays that don't have support for it at a graphics card level. --- modules/programs/autorandr.nix | 8 ++++++++ tests/modules/programs/autorandr/basic-configuration.nix | 2 ++ 2 files changed, 10 insertions(+) diff --git a/modules/programs/autorandr.nix b/modules/programs/autorandr.nix index 69505f255..3eeedfc2b 100644 --- a/modules/programs/autorandr.nix +++ b/modules/programs/autorandr.nix @@ -176,6 +176,13 @@ let } ''; }; + + filter = mkOption { + type = types.nullOr (types.enum [ "bilinear" "nearest" ]); + description = "Interpolation method to be used for scaling the output."; + default = null; + example = "nearest"; + }; }; }; @@ -261,6 +268,7 @@ let ++ optional (config.mode != "") "mode ${config.mode}" ++ optional (config.rate != "") "rate ${config.rate}" ++ optional (config.rotate != null) "rotate ${config.rotate}" + ++ optional (config.filter != null) "filter ${config.filter}" ++ optional (config.transform != null) ("transform " + concatMapStringsSep "," toString (flatten config.transform)) ++ optional (config.scale != null) diff --git a/tests/modules/programs/autorandr/basic-configuration.nix b/tests/modules/programs/autorandr/basic-configuration.nix index c28edaa2a..e650f6005 100644 --- a/tests/modules/programs/autorandr/basic-configuration.nix +++ b/tests/modules/programs/autorandr/basic-configuration.nix @@ -17,6 +17,7 @@ primary = true; position = "0x0"; mode = "1920x1080"; + filter = "nearest"; transform = [ [ 0.6 0.0 0.0 ] # a b c [ 0.0 0.6 0.0 ] # d e f @@ -50,6 +51,7 @@ crtc 0 primary mode 1920x1080 + filter nearest transform 0.600000,0.000000,0.000000,0.000000,0.600000,0.000000,0.000000,0.000000,1.000000'' } '';