KDE plasma 5 provides excellent support for HiDPI screens out of the box: You can set the correct DPI by #Using KDE system settings.
Playing with GDK_SCALE and GDK_DPI_SCALE values can be useful in case you want to tune GTK app scale in KDE without affecting QT app. For example you may want to do not use the Scale value in KDE Display setting as not integer values creates issues with some QT application fonts.
# cp /usr/share/xsessions/plasma.desktop /usr/share/xsessions/plasma-custom.desktop # sed -i 's/\/usr\/bin\/startkde/\/usr\/bin\/startkde-custom/g' /usr/share/xsessions/plasma-custom.desktop # sed -i 's/Plasma/Plasma (custom)/g' /usr/share/xsessions/plasma-custom.desktop
Example for a generic 13" 1920x1080 (You may need to adjust these values depending on your display):
#!/bin/bash ## GDK_SCALE only integer values (ex. 1 2 3 ) export GDK_SCALE=1 ## GDK_DPI_SCALE can be non integer (ex. 1.1 1.2 ) export GDK_DPI_SCALE=1.2 export XCURSOR_SIZE=48 /usr/bin/startkde "$@"
Example for a 15" Retina Macbook Pro (The negative dpi scale ensures that the text is sized correctly):
#!/bin/bash export GDK_SCALE=2 export GDK_DPI_SCALE=-1 export XCURSOR_SIZE=48 /usr/bin/startkde "$@"
Do not forget to ensure that the script can be executed (
# chmod +x /usr/bin/startkde-custom). Logout and choose your new custom session (you may need to restart your display manager for it to show up) and GTK+ applications should be scaled correctly.
Using KDE system settings
You can use KDE's settings to fine tune font, icon, and widget scaling. This solution affects both Qt and Gtk+ applications.
To adjust font, widget, and icon scaling together:
- System Settings → Display and Monitor → Display Configuration → Scale Display
- Drag the slider to the desired size
- Restart for the settings to take effect
To adjust only font scaling:
- System Settings → Fonts
- Check "Force fonts DPI" and adjust the DPI level to the desired value. This setting should take effect immediately for newly started applications. You will have to logout and login for it to take effect on Plasma desktop.
To adjust only icon scaling:
- System Settings → Icons → Advanced
- Choose the desired icon size for each category listed. This should take effect immediately.
Display Scale not integer bug :
When you use not integer values for Display Scale it causes font render issue in some QT application ( ex. okular ).
A workaround for this is to:
- Set the scale value to 1
- Adjust your font and icons and use the "Force fonts DPI" ( this affects all apps, also GTK but not create issue with the fonts )
- Restart KDE
- If required tune the GTK apps using the variables GDK_SCALE/GDK_DPI_SCALE (as described above)
Tray icons with fixed size
If the tray icons are not scaled with the rest of the desktop, the size can be set in the Plasma configuration. System-wide configuration is located in the file
/usr/share/plasma/plasmoids/org.kde.plasma.private.systemtray/contents/config/main.xml, where the dimension of icons can be controlled by editing the default value for iconSize (a value of 2 should be fine):
<entry name="iconSize" type="Int"> <label>Default icon size for the systray icons, it's an enum which values mean, Small, SmallMedium, Medium, Large, Huge, Enormous respectively. On low DPI systems they correspond to 16, 22, 32, 48, 64, 128 pixels. On high DPI systems those values would be scaled up, depending on the DPI.</label> <default>2</default> </entry>
User configuration is located in the file
~/.config/plasma-org.kde.plasma.desktop-appletsrc. The section containing the settings for the tray bar should look similar to this; if the
iconSize field is not present, add it.
[Containments][General] extraItems=org.kde.plasma.mediacontroller,org.kde.plasma.battery,org.kde.plasma.printmanager,org.kde.plasma.bluetooth,org.kde.plasma.clipboard,org.kde.plasma.notifications,org.kde.plasma.networkmanagement,org.kde.plasma.devicenotifier hiddenItems=org.kde.ktp-contactlist,org.kde.plasma.battery knownItems=org.kde.plasma.mediacontroller,org.kde.plasma.battery,org.kde.plasma.printmanager,org.kde.plasma.bluetooth,org.kde.plasma.clipboard,org.kde.plasma.notifications,org.kde.plasma.networkmanagement,org.kde.plasma.devicenotifier shownItems=org.kde.plasma.notifications,org.kde.plasma.clipboard iconSize=2