Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xdg-desktop-portal-gtk breaks font hinting #93199

Closed
colemickens opened this issue Jul 15, 2020 · 11 comments
Closed

xdg-desktop-portal-gtk breaks font hinting #93199

colemickens opened this issue Jul 15, 2020 · 11 comments

Comments

@colemickens
Copy link
Member

Describe the bug
I noticed that enabling some XDG options, it breaks my GTK fonts:

    # disable, making fonts look terrible in wofi/termite
    #xdg.portal.enable = true;
    #xdg.portal.gtkUsePortal = true;

Then when working on firefox and pipewire-0.3 patching today, I noticed this in @calbrecht's repo: https://github.com/calbrecht/nixpkgs-overlays/blob/11e28f1b10e48446811839680dec66691b57667b/nixpkgs/pkgs-overlays/xdg-desktop-portal-gtk/default.nix

self: pkgs:
pkgs.xdg-desktop-portal-gtk.overrideAttrs (old: {
  buildInputs = old.buildInputs ++ [
    # portal needs schema org.gnome.settings-daemon.plugins.xsettings
    # else it will not hint the fonts
    pkgs.gnome3.gnome-settings-daemon
  ];
})

It looks like we might want to fix this in nixpkgs.

@colemickens colemickens changed the title xdg-desktop-portal-gtk breaks fonts xdg-desktop-portal-gtk breaks font hinting Jul 15, 2020
@jtojnar
Copy link
Member

jtojnar commented Jul 16, 2020

Right, looks like it is required since at least 1.5.0:

flatpak/xdg-desktop-portal-gtk@0aa1006

colemickens added a commit to colemickens/nixpkgs that referenced this issue Jul 16, 2020
This fixes "xdg-desktop-portal-gtk breaks font hinting".
Aka, NixOS#93199.
worldofpeace pushed a commit that referenced this issue Jul 17, 2020
This fixes "xdg-desktop-portal-gtk breaks font hinting".
Aka, #93199.

(cherry picked from commit 749418c)
@mweinelt
Copy link
Member

mweinelt commented Oct 3, 2020

I still experience font hinting issues when enabling gtkUsePortal on 98d2d8c. I'm using sway. Is the option only supported when actually running a GNOME environment?

@colemickens
Copy link
Member Author

I haven't had issues in Sway since this was merged: #93307

@mweinelt
Copy link
Member

mweinelt commented Oct 3, 2020

Ah, I was missing xdg-desktop-portal-gtk in extraPortals, after I added that the hinting went back to being fine. Screensharing also work now \o/

@layus
Copy link
Member

layus commented Dec 28, 2020

I do not know if my config has anything special, but with current nixos-unstable (21.03pre259928.2f47650c2f2 (Okapi)) I do experience the issue.

{
  xdg = {
    icons.enable = true;
    portal = {
      enable = true;
      extraPortals = with pkgs; [
        xdg-desktop-portal-gtk
        xdg-desktop-portal-wlr
      ];
      gtkUsePortal = true;
    };
  };
}

Even stranger: ps axu | grep portal show no -gtk nor -wlr portal running, only plain xdg-desktop-portal processes.

I am a bit lost here. Just reverted for now, but I am far from making https://github.com/calbrecht/nixpkgs-overlays work.

@calbrecht
Copy link
Member

Sorry to read that @layus. Since September 2020 the overlay is obsolete, that is, all patches that i had copied in there, are present and meanwhile updated/outdated in nixpkgs master. I updated the Readme to reflect that, also added links to the resources i use to debug problems with the setup.

Also, it seems to be mandatory to add to ~/.config/sway/config

exec systemctl --user import-environment

@layus
Copy link
Member

layus commented Dec 29, 2020

Investigating further. It seems that if I systemctl --user import-environment and restart dbus afterwards it works correctly.

AFAIU the challenge is to get xdg-desktop-portal and co. to have access to env vars defined by sway.
Adding systemctl --user import-environment does not work because at that time dbus is already started when sway starts.
My workflow is

  1. login to tty and get a zsh login shell
  2. type sway in that shell.
    logind starts dbus on login. Too early for me.

Another option seems to use dbus-update-activation-environment --systemd --all. This should work for the portals that have not yet been activated. But if your sway config starts applications (mine starts firefox and waybar) then it gets racy. Will report here my attempts.

@calbrecht Could you explain how you are running sway ? I cannot believe it only fails for me.

@calbrecht
Copy link
Member

@layus sure. It is nearly the same as you do manually, with the difference that i do exec sway and so replace the shell, if i understand correctly.

{
environment.interactiveShellInit = ''
    if test `tty` = /dev/tty1; then
       exec sway
    fi
  '';
}

@layus
Copy link
Member

layus commented Dec 29, 2020

Hmmm. I do not see what it could possibly change. Still, yet another thing to test :-D

@calbrecht
Copy link
Member

I don't know maybe you need both of those at the end of your ~/.config/sway/config

exec systemctl --user import-environment
exec systemctl --user start graphical-session.target

like stated in #106815 (comment). I just did not mention it because for @fadenb it did not seem to be required.

@layus
Copy link
Member

layus commented Dec 29, 2020

Well, I have discovered that my setup was "polluted" by the gdm display-manager that I kept in another tty for easy switching to X11 when I needed advanced screencasting in Teams :-).

This gdm spawned its own dbus, and mingled in various ways with nixos config. I have to test again everything. I guess it was also responsible for starting the graphical-session.target

I wonder who is responsible for starting dbus in your setup. I guess it is socket-activated. Just checked. It is indeed. That also explains why exec systemctl --user import-environment works.

It is a bit unfortunate that you cannot start gdm besides sway. I will have to figure out how to install it without starting it at boot. Or just make screencasting work in sway and forget X11 forever 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants