mirror of
https://codeberg.org/privacy1st/nix-git
synced 2025-01-12 05:06:06 +01:00
fractional scaling: rm support for X11
This commit is contained in:
parent
10c307beb5
commit
d62b72dc35
@ -29,8 +29,7 @@
|
||||
../../modules/gnome-base.nix
|
||||
../../modules/gnome-config.nix
|
||||
../../modules/gnome-extensions.nix
|
||||
# TODO currently broken
|
||||
#../../modules/gnome-fractional-scaling.nix
|
||||
../../modules/gnome-fractional-scaling.nix
|
||||
../../modules/fwupd-gnome.nix
|
||||
../../modules/gnome-wallpaper.nix
|
||||
|
||||
|
@ -1,10 +1,5 @@
|
||||
{ config, pkgs, lib, ... }:
|
||||
let
|
||||
version = "45.5";
|
||||
in
|
||||
{
|
||||
# TODO: This module is broken for 46.2
|
||||
|
||||
# https://wiki.archlinux.org/title/HiDPI#Wayland
|
||||
# Results in blurry font in non-Wayland applications :/
|
||||
|
||||
@ -14,70 +9,23 @@ in
|
||||
# "scale-monitor-framebuffer": This allows GNOME to scale each monitor’s framebuffer independently, which is necessary for per-monitor scaling.
|
||||
# "x11-randr-fractional-scaling": This allows fractional scaling, which gives you finer control over the scaling factor.
|
||||
|
||||
# TODO open issue: Fractional scaling can't be enabled with multiple monitors.
|
||||
# TODO: Open issue. Fractional scaling can't be enabled with multiple monitors.
|
||||
# TODO: X11 or Wayland or both?
|
||||
# https://gitlab.gnome.org/GNOME/gnome-control-center/-/issues/2076
|
||||
# https://gitlab.gnome.org/GNOME/gnome-control-center/-/issues/2365
|
||||
# -> https://bugs.launchpad.net/ubuntu/+source/gnome-control-center/+bug/2008355
|
||||
|
||||
assertions = [{
|
||||
assertion = config.services.xserver.displayManager.gdm.wayland;
|
||||
message = "Fractional scaling is only supported for Wayland. There is a patch for X11, but we no longer apply it in an overlay. See e.g. https://aur.archlinux.org/packages/mutter-x11-scaling";
|
||||
}];
|
||||
|
||||
programs.dconf.enable = true;
|
||||
|
||||
# Overlays.
|
||||
# https://nixos.wiki/wiki/Overlays#In_NixOS
|
||||
# https://discourse.nixos.org/t/use-specific-pkg-version-in-overlay/32741/3
|
||||
|
||||
# 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
|
||||
#
|
||||
# On the AUR, they apply only one patch, not three.
|
||||
# And they pick the patch that corresponds to the mutter version.
|
||||
# https://aur.archlinux.org/packages/mutter-x11-scaling
|
||||
#
|
||||
# New patch URL:
|
||||
# -> https://salsa.debian.org/gnome-team/mutter/-/blob/ubuntu/master/debian/patches/ubuntu/x11-Add-support-for-fractional-scaling-using-Randr.patch
|
||||
# For release 44.2:
|
||||
# -> https://salsa.debian.org/gnome-team/mutter/-/tags?sort=updated_desc&search=ubuntu%2F
|
||||
# -> https://salsa.debian.org/gnome-team/mutter/-/tags/ubuntu%2F44.2-3ubuntu1
|
||||
# -> https://salsa.debian.org/gnome-team/mutter/-/raw/ubuntu/44.2-3ubuntu1/debian/patches/ubuntu/x11-Add-support-for-fractional-scaling-using-Randr.patch
|
||||
# For release 45.3:
|
||||
# -> https://salsa.debian.org/gnome-team/mutter/-/tags?sort=updated_desc&search=ubuntu%2F
|
||||
# -> https://salsa.debian.org/gnome-team/mutter/-/tags/ubuntu%2F45.3-1ubuntu1
|
||||
# -> https://salsa.debian.org/gnome-team/mutter/-/raw/ubuntu/45.3-1ubuntu1/debian/patches/ubuntu/x11-Add-support-for-fractional-scaling-using-Randr.patch
|
||||
|
||||
# Elements of nixpkgs must be taken from final and prev.
|
||||
final: prev: {
|
||||
# Elements of pkgs.gnome must be taken from gfinal and gprev.
|
||||
gnome = prev.gnome.overrideScope' (gfinal: gprev: {
|
||||
mutter = gprev.mutter.overrideAttrs (oldAttrs:
|
||||
if oldAttrs.version == version then
|
||||
{
|
||||
patches = (oldAttrs.patches or []) ++ [
|
||||
(prev.fetchpatch {
|
||||
url = "https://salsa.debian.org/gnome-team/mutter/-/raw/ubuntu/${version}-1ubuntu1/debian/patches/ubuntu/x11-Add-support-for-fractional-scaling-using-Randr.patch";
|
||||
# Determining the hash: https://github.com/NixOS/nixpkgs/issues/191128#issuecomment-1246030431
|
||||
hash = "sha256-snEgCuTsTEo0wQ5XsjEM53K2j7l4ZQ3t9FT3+Yfoti0=";
|
||||
})
|
||||
];
|
||||
}
|
||||
else throw "Mutter version mismatch. Please update patch to ${oldAttrs.version}"
|
||||
);
|
||||
});
|
||||
}
|
||||
)
|
||||
];
|
||||
|
||||
home-manager.users.yoda = { osConfig, config, pkgs, ... }: {
|
||||
dconf.settings = {
|
||||
"org/gnome/mutter" = {
|
||||
experimental-features = (
|
||||
if (osConfig.services.xserver.displayManager.gdm.wayland)
|
||||
# Wayland
|
||||
then ["scale-monitor-framebuffer"]
|
||||
# X11
|
||||
else ["scale-monitor-framebuffer" "x11-randr-fractional-scaling"]
|
||||
);
|
||||
experimental-features = ["scale-monitor-framebuffer" "xwayland-native-scaling"];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user