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

KDE applications over-scaled on HiDPI display #96055

Closed
oxalica opened this issue Aug 23, 2020 · 9 comments
Closed

KDE applications over-scaled on HiDPI display #96055

oxalica opened this issue Aug 23, 2020 · 9 comments

Comments

@oxalica
Copy link
Contributor

oxalica commented Aug 23, 2020

Describe the bug
Some KDE applications like Dolphin and Konsole get GUI over-scaled on current master. But they works fine before #84232 .

To Reproduce
Steps to reproduce the behavior:

  1. Checkout current master(5be356a9)
  2. Use this configuration to build-vm:
{
  users.users.root.initialPassword = "";
  services.xserver = {
    enable = true;
    dpi = 144;
    desktopManager.plasma5.enable = true;
    displayManager.sddm.enable = true;
  };
}
  1. Run the VM and check Dolphin GUI.
  2. Checkout de1c8a03^ (the parent of the merge commit of staging branch, actually eac5ef8a) and repeat steps above.

Expected behavior
Font size, icon size and menu height should be smaller and be the same as previous.

Screenshots
Note that for comparison, "System Settings" has correct GUI scale in both screenshots, but "Dolphin" does not.
Title bar always has correct font size.

Current master: (Dolphin GUI is too large)
Screenshot_20200823_124257

Expected: (Previous. Tested on eac5ef8aa9c0ddd948b20e83d9d7b37cd0132a81)
Screenshot_20200823_130950

Additional context
In KDE "Display Configuration", "Global scale" is always set to 1.0. Only xserver dpi is set.

Notify maintainers

@petabyteboy
cc @worldofpeace @ttuegel

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

  • system: "x86_64-linux"
  • host os: Linux 5.4.59, NixOS, 20.09pre239318.c59ea8b8a0e (Nightingale)
  • multi-user?: yes
  • sandbox: yes
  • version: nix-env (Nix) 2.3.7
  • channels(root): "nixos-20.09pre239318.c59ea8b8a0e"
  • channels(oxa): "home-manager, mozilla"
  • nixpkgs: /nix/var/nix/profiles/per-user/root/channels/nixos

Maintainer information:

# a list of nixpkgs attributes affected by the problem
attribute:
# a list of nixos modules affected by the problem
module: services.xserver.desktopManager.plasma5
@ttuegel
Copy link
Member

ttuegel commented Aug 27, 2020

There were changes upstream to HiDPI support in Qt 5.14. The linked changelog suggests some environment variables you could try. In particular, you might make sure that QT_AUTO_SCREEN_SCALE_FACTOR is not set. You might also look at QT_SCREEN_SCALE_FACTORS to make sure that global scaling is actually disabled.

This is somewhat strange, but on my physical HiDPI display, I don't see any overscaling. Actually, I have to enable global scaling to get readable text, but I tried it with global scaling disabled for debugging. The only scaling problem I have is that the desktop (including tray icons and cursor) doesn't seem to be scaled correctly. 🤔

@ttuegel
Copy link
Member

ttuegel commented Aug 27, 2020

I don't see any overscaling

Actually, I do see some overscaling, but it's not consistent. Some applications seem to be OK, some are underscaled, and some are overscaled. I want to see if this persists in Plasma 5.18; I think that Plasma handles scaling itself and disables Qt auto-scaling, and I wonder if Plasma 5.17 just isn't compatible with Qt 5.14 (which is much newer).

@oxalica
Copy link
Contributor Author

oxalica commented Aug 27, 2020

@ttuegel

Actually, I do see some overscaling, but it's not consistent.

Yeah... For me, just Dolphin and Konsole have the issue, which can be most common used apps.

In particular, you might make sure that QT_AUTO_SCREEN_SCALE_FACTOR is not set. You might also look at QT_SCREEN_SCALE_FACTORS to make sure that global scaling is actually disabled.

They are both not set (also not occur in nixpkgs or wrappers). And I did some other tests on dolphin:

  • QT_AUTO_SCREEN_SCALE_FACTOR=0 results in normal (expected) scale. 1 or unset cause overscale.
    Maybe it's on by default now?
  • QT_SCREEN_SCALE_FACTORS=1 or 2 or unset cause overscale. (Seems current (over)scale is 2.)
    1.5 results in expected scale. (Why isn't it to be 1.5*1.5=2.25? Does it ignore xserver.dpi?)
  • QT_AUTO_SCREEN_SCALE_FACTOR only takes effect when QT_SCREEN_SCALE_FACTORS=1 or unset.
    Otherwise, the given scale factors is used.

@ttuegel
Copy link
Member

ttuegel commented Aug 31, 2020

For me, just Dolphin and Konsole have the issue, which can be most common used apps.

I also have overscaling in window title bars and desktop panels, but in both those places, only the fonts are overscaled, not icons as in other applications.

QT_AUTO_SCREEN_SCALE_FACTOR=0 results in normal (expected) scale. 1 or unset cause overscale. Maybe it's on by default now?

It is off by default on my desktop, and I still see overscaling. 🤔

QT_SCREEN_SCALE_FACTORS is supposed to take a list of display names and scale factors; I don't know what happens when it's set to a single number, but that's not how it's supposed to be used. This is the environment variable that the System Settings module sets, for example. It ignores DPI and overrides QT_AUTO_SCREEN_SCALE_FACTOR.

@oxalica
Copy link
Contributor Author

oxalica commented Aug 31, 2020

@ttuegel

Played with System Setting - Hardware - Display and Monitor - Global scale.
It's even more confusing. I expect the scale to be slightly bigger than 1.4x but it seems to jump to 2.0x when set to 1.5x or larger, or 1.0x (default).

Screenshot_20200831_231347

Well, I don't know the detail about how global settings work. I can't discover QT_SCREEN_SCALE_FACTORS from env, but it is somehow passed to the apps.

It (QT_AUTO_SCREEN_SCALE_FACTOR) is off by default on my desktop, and I still see overscaling. 🤔

Do you check it by env? Not sure if there's any other hidden configuration.

@ttuegel
Copy link
Member

ttuegel commented Aug 31, 2020

I check the settings by env or echo:

echo $QT_SCREEN_SCALE_FACTORS
DisplayPort-0=2;DisplayPort-1=2;DisplayPort-2=2;

There is no hidden configuration, just the environment. However, it is possible that programs will get a different environment depending on how they are started because some things are launched via D-Bus and inherit the environment from there. The environments are supposed to be synchronized, but it's hard to rule out a problem.

There is a lot of good information in this blog post. It looks like this is not a NixOS specific issue, but something that many people are struggling with using Plasma and Qt >= 5.14.

@ttuegel
Copy link
Member

ttuegel commented Sep 1, 2020

As always, ArchWiki has lots of information.

On the "bad" configuration, I have:

  • PLASMA_USE_QT_SCALING is unset
  • QT_SCREEN_SCALE_FACTORS=HDMI-A-0=2;DVI-D-0=2;VGA-0=2;
  • QT_AUTO_SCREEN_SCALE_FACTOR=0
  • QT_SCREEN_SCALE_FACTOR is unset

On the "good" configuration, I have:

  • PLASMA_USE_QT_SCALING=1
  • QT_SCREEN_SCALE_FACTORS=DisplayPort-0=2;DisplayPort-1=2;DisplayPort-2=2;
  • QT_AUTO_SCREEN_SCALE_FACTOR is unset
  • QT_SCREEN_SCALE_FACTOR is unset

The really weird thing is that startplasma-x11 sets QT_AUTO_SCREEN_SCALE_FACTOR=0, so I don't know when it gets unset. I also can't figure out who sets PLASMA_USE_QT_SCALING.

@oxalica
Copy link
Contributor Author

oxalica commented Sep 9, 2020

Seem to be fixed in latest nixos-unstable (6152513).

@nixos-discourse
Copy link

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/how-to-correct-nvidia-driver-resolution/14183/2

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

4 participants