Making Plasma Superb in HiDPI

notebook-xps-13-polaris-pdp-design-1.jpgNot long ago I purchased a Dell XPS 13 with the HiDPI touchscreen. It was one of the Project Sputnik “Developer Edition” laptops loaded with Ubuntu from the factory; nice and clean. This was my first foray into using a HiDPI screen in Linux. From my research before purchasing, it sounded like a mixed bag of functionality. I fired up a bunch of apps, tested them out and dutifully submitted a bunch of bug reports regarding scaling issues to a number of projects. From there, once ushered into the development side of KDE, I decided to start helping out with fixing some of the issues I saw with KDE/Qt apps.

It appears there are still very few users and even fewer developers with a HiDPI screen who run 2x scaling, so I notice things others don’t. Most of it revolves around window sizes upon loading, interface button and label sizes, and icon pixelation. Minor stuff, but annoying.

The latter of which, is actually really easy to fix in Qt apps.

It’s one line:


Enter that into main.cpp of the program and you’re set! Even myself, a rather entry-level programmer can perform that task and submit a patch. So that’s what I did for several applications.

Look carefully at the before/after pixelation of the icons here in KTorrent:

Some more examples and links to Phabricator, please ignore any change of icon colors, that is a different issue that has been recently resolved:

I have a few more in my list, such as the AppMenu button you can add to KWin. Anyone want to tackle that?

But anyway, lots of progress is being made! These sorts of fixes, along with ones like display of scaled icons from intended folder, 2x icons in Breeze, enhanced scaling abilities in Wayland, and implementation of HiDpiScaling in some older apps are being committed constantly.

Running the latest Plasma release, there are very few HiDPI issues left, and a good portion of them can be blamed on X.

You could help do easy tasks like this too!

Visit KDE’s Get Involved page for more information, or contact me!

16 thoughts on “Making Plasma Superb in HiDPI

    1. It’s really just historical. All of these apps date back many years, so they never had the opportunity to have that line of code entered until now. It does appear safe for all applications though, so I am just finding windows that need it as I test out applications.


      1. I meant that Qt should set it by itself as part of Q(Gui)Application initialization. I understand that it may cause some problems for some applications, however I believe that the developer shoudn’t need to set every little thing, especially when this is only sensible choice for HiDPI environments.

        Liked by 1 person

  1. Great news that you’re fixing this up. Would you mind switching between kwin_x11 and kwin_wayland a few times to make sure that you get the same experience as both. The bugs I raised were auto closed by Martin despite me demonstrating different behaviours between the two


    1. You would think so, but there’s apparently a number of lines that need to be entered in applications to make scaling work properly. I do wish there were one simple place to make it all happen though.


  2. It’s gotten better, but plasma itself still doesn’t scale properly everywhere: look at the size of menu entries when right clicking anywhere on the bottom panel, as well as the size of everything in the settings window of a plasma widget.


    1. Yep, there are still some minor things like that on X. That’s not an issue on Wayland, although there are many other things that are an issue on Wayland right now.

      You can fix that by enabling the variable: PLASMA_USE_QT_SCALING=1

      It is not enabled by default, due to apparent issues that it can cause, but I will say that I have never seen them. I am not the ultimate authority on that though.


      1. Wow, this is amazing, thanks! By any chance, you wouldn’t know how to convince sddm to respect hidpi settings too ?


      2. Unfortunately SDDM’s “EnableHiDPI” is sort of broken right now:

        Some distro’s like openSuSE seem to work, but other’s dont.

        But, you can add the following to /etc/sddm.conf:

        ServerArguments=-dpi 192

        Set the -dpi amount to whatever you want. So for example I want 2x scaling, so I double the standard dpi of 96 to get the 192. Make sure to keep whatever arguments are already there, if any, and just add the -dpi ### after that.


  3. It should be noted that QGuiApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); is not always safe to add. If you are using some custom rendering with QPainter, you most likely need to adjust your code. For instance, if you are rendering a custom QImage, you’ll need to get the device pixel ratio (or even better, the screen pixel ratio, as there might be more than one screen), and call setDevicePixelRatio on it.


  4. Great bug catching.

    I have the same laptop as you do and running kde.
    So it adds a couple more eyeballs to report and fix hiDPI related bugs.

    Keep up the great contributions.


    1. I have the same setup in the reverse. In Xorg, it’s extremely annoying and hard to set up, but you can do it. In Wayland, it works fine with the Displays config. But Wayland support has its own issues at the moment. So, a mixed bag.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s