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" + ) ]; }; };