From a8123630390621e0868f6238d8e83dca94318b37 Mon Sep 17 00:00:00 2001 From: Daniel Langbein Date: Mon, 18 Sep 2023 21:49:26 +0200 Subject: [PATCH] fractional scaling in X11/Wayland --- modules/gnome-fractional-scaling.nix | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/modules/gnome-fractional-scaling.nix b/modules/gnome-fractional-scaling.nix index d6c1cc8..ce4f8ff 100644 --- a/modules/gnome-fractional-scaling.nix +++ b/modules/gnome-fractional-scaling.nix @@ -1,4 +1,4 @@ -{ config, pkgs, ... }: +{ config, pkgs, lib, ... }: { # https://wiki.archlinux.org/title/HiDPI#Wayland @@ -11,7 +11,9 @@ # Overlays. # https://nixos.wiki/wiki/Overlays#In_NixOS # https://discourse.nixos.org/t/use-specific-pkg-version-in-overlay/32741/3 - nixpkgs.overlays = [ + + # If on X11, then use patched version of mutter. + nixpkgs.overlays = lib.mkIf (! config.services.xserver.displayManager.gdm.wayland) [ ( # Patched version of mutter 44.2. # Outdated example: https://nixos.wiki/wiki/Overlays#Overriding_a_package_inside_a_scope @@ -55,10 +57,13 @@ dconf.settings = { "org/gnome/mutter" = { experimental-features = [ - # Wayland fractional scaling - "scale-monitor-framebuffer" - # X11 fractional scaling - "x11-randr-fractional-scaling" + ( + if (osConfig.services.xserver.displayManager.gdm.wayland) + # Wayland fractional scaling + then "scale-monitor-framebuffer" + # X11 fractional scaling + else "x11-randr-fractional-scaling" + ) ]; }; };