SSH – Qt5-Anwendungen – KDE/Plasma 5 – falsche Fonts und fehlende Icons

Wenn man sich unter KDE 5 mit
"ssh -X remoteuser@sshhost"
auf einem Host "sshhost"einloggt und dann Qt5-Anwendungen startet, werden die in der Regel nicht richtig angezeigt: Es fehlen Icons und die Fonts sind falsch.
("remoteuser" und "sshhost" sind im Beispiel natürlich nur Dummy-Bezeichnungen, die durch richtige Werte ersetzt werden müssen.)

Ursache des Darstellungsproblems:
Qt5-Applikationen suchen die Einstellungen der aktuell laufenden Desktopumgebung - im Beispiel also auf auf dem per SSH angesprochenen Host "sshhost". Dort wird aber KDE nicht erkannt, weil eine Umgebungsvariable nicht gesetzt ist, die normalerweise beim Start der Desktop-Umgebung belegt wird. Dort läuft ja aber für die ssh-Shell gar kein Desktop.

Ich hatte das Problem schon mal behandelt - allerdings für root-Shells und lokale Starts von Qt5-Anwendungen auf ein und demselben System (siehe http://linux-blog.anracom.com/2016/01/27/opensuse-leap-42-1-kde-5-unzureichende-darstellung-und-kleine-fonts-in-qt5-anwendungen-die-von-root-gestartet-werden/).

Die gleiche Thematik verfolgt einen aber natürlich auch in Shells, die mit SSH geöffnet werden.

Lösungsansatz:
Man kann der SSH-Sitzung die notwendige Umgebungsvariable am Prompt nachliefern. Nämlich über:

remoteuser@sshhost:~>export XDG_CURRENT_DESKTOP=KDE

Erfolgte die SSH-Sitzung aus einem Gnome-Desktop heraus, so wählt man natürlich eher:

remoteuser@host:~>export XDG_CURRENT_DESKTOP=GNOME

Arbeitet man lokal und remote grundsätzlich nur unter KDE, so kann man die Einstellung

export XDG_CURRENT_DESKTOP=KDE

auch in der Datei "~/.profile" verankern. Die Umgebungsvariable wird dann für alle Login-Sitzungen gesetzt.

Arbeitet man allerdings nicht nur remote auf dem Host "sshhost" und wechselt man dort (!) gelegentlich zwischen KDE und Gnome, so ist wohl eine vorherige Abfrage in der "~/.profile" sinnvoller - und man entscheidet sich nur im Zweifel für KDE:

[ "$XDG_CURRENT_DESKTOP" = "KDE" ] || [ "$XDG_CURRENT_DESKTOP" = "GNOME" ] || export XDG_CURRENT_DESKTOP=KDE

Bessere interaktive Lösung:
Man verankert in der "~/.profile" für den Fall einer SSH-Verbindung eine interaktive Abfrage, die den SSH-Nutzer festlegen lässt, welche Desktop-Umgebung den anschließend gestarteten Qt5-Anwendungen vorgegaukelt werden soll. Die entsprechende Desktop-Umgebung muss auf dem SSH-Host natürlich vom User konfiguriert worden sein.

Der Aufbau eines entsprechenden Shellskripts ist eine nette kleine Übungsaufgabe, bei deren Lösung ggf. folgender Link weiterhilft:
http://unix.stackexchange.com/questions/9605/how-can-i-detect-if-the-shell-is-controlled-from-ssh

Nachtrag 01.11.2016: SSH, KDE und User root

Will man aus irgendwelchen Gründen für den User "root" über SSH grafische Anwendungen starten, so nützt im Gegensatz zur Situation in einer bereits laufenden grafischen KDE-Umgebung nichts, einfach "kdesu ..." zu benutzen. Wir hatten dieses Vorgehen im Artikel Opensuse Leap 42.1 / KDE 5 – unzureichende Darstellung (kleine Fonts, fehlende Icons) von Qt5-Anwendungen, die von root gestartet werden empfohlen. Ist eine SSH-Shell dazwischengeschaltet, so muss die oben erläuterte Umgebungsvariable vor Anwendung des "kdesu"-Befehls für eine grafische Qt5-Anwendung explizit gesetzt werden.

Linux – Dell U2515H – questions regarding KDE adjustments and older graphics cards

Some months ago I wrote 2 blog articles about the use of (multiple) DELL U2515H screens on a Nvidia GTX750 TI graphics card on a Linux system.

Linux – Nvidia GTX 750 TI – Parallelbetrieb von 2 Dell U2515H mit 2560×1440 plus einem 1920×1200 Schirm
Linux – Nvidia GTX 750 TI – Dell U2515H – HDMI – 2560×1440 Pixel

Last week a reader, who had found these blog articles, asked me the following:

I am currently using a Dell U2412m with 1920x1200 resolution but I am planning to upgrade to a 2560x1440 and thought about the U2515H but I am a bit worried about how Plasma shows on such a high dpi panel. Do you have any issue with interface elements which are showed too small and are not tuneable?

Second thing I am a bit worried of my GTS 450 performance but I will upgrade my video card after the new nVidia series is launched.

I found these questions interesting and present my answers in form of this blog contribution.

Warning statement regarding older graphics cards

Before I get to the question regarding KDE and a high resolution screen as the DELL U2515H I want to make a warning statement:

The graphics card you want to use together with a Dell U2515H and the graphics card drivers MUST support high resolution HDMI (vers. 1.4, 2.0) or display port connections. Reason: The Dell U2515 does NOT provide any DVI connections!

Do not underestimate this topic for older graphics cards! Actually, I had very bad experiences in the past with a GTX 460 which provides a mini HDMI port: I never got a high resolution HDMI connection to run with this card (not under Opensuse 13.1/13.2). Despite high quality cables and in contrast to another system with a GTX 750 TI. And I really tried a lot of settings and driver versions until I gave up.

And note: Even the GTX 750TI required some effort and fiddling - but eventually it worked. This is the reason why I wrote about it.

So, if you have some money and want to avoid frustration with the DELL U2515H, I would suggest to buy a reasonable modern card which offers support for (several) display ports and/or high resolution HDMI. If gaming under Linux is not a topic (as in my case) but still some 3D applications or CUDA floating point operations are part of your work then presently a GTX 960 or the GTX 750 could be a reasonable alternative regarding the price-value relation. But look out for the number of ports supported - especially if you want to use several screens.

KDE and high resolution screens in general

It is quite clear that a screen resolution of 2560x1440 will significantly reduce the visible size of fonts and desktop elements scaled with font size. So, what you need is a very flexible scalability of fonts both for the desktop and window control elements as well as for applications you use.

The question whether Linux desktops as KDE are prepared for high resolution screens was also posed in an article with the title "Skaliert" (Scaled) published in the German "linuxuser" 10/2015. See http://www.linux-community.de/Internal/Artikel/Print-Artikel/LinuxUser/2015/10/Skaliert. Unfortunately, this article costs money to read it online. Actually, relatively small problems were described for KDE. This is very consistent with my own experience with both KDE 4.14 and KDE 5.x.

You can adjust almost all required basic font settings for the KDE desktop via KDE's "systemsettings" and in addition most applications offer scrollable and relatively seamless font scaling (e.g. via mouse scrolling). Playing around with font smoothing plus an enforcement of dpi resolution may pay off in case you care for smooth font displaying. (Actually I never had to apply any special contrast settings of the screen itself beyond standards for the screen to get a clear, but nevertheless smooth font display).

The spectrum of applications I primarily use consists of a mixture of QT and GTK applications:

KDE konsole and other terminal emulations, different types of graphical KDE file editors, different types of browsers (primarily FF and chromium), libreoffice, eclipse mars, aptana studio, SVN frontends, crossover with ms office applications, vmware with different types of guests, kvm with different types of guests, sound and multimedia applications, blender, etc., etc.

Almost all of my favorite applications offer internal font adjustment capabilities and the typical graphical elements of these applications scale seamlessly with font size. So, no reason to worry about KDE and its plasma desktop: In my opinion KDE is well prepared for high resolution screens.

A problem may, however, be the smooth integration of some GTK applications (as e.g. eclipse) into high resolution KDE, which is based on QT - but also there you have sufficient options with different GTK themes - and most of the problems I had were independent of the screen resolution and more GTK theme dependent. You may have to play around a bit with KDE's settings for GTK integration - especially with the choice of the GTK design or GTK theme.

KDE and screens with different resolutions

A real problem in my opinion may result from a mixture of 2 screens with different (!) native resolutions. There is no way known to me to apply different font-settings to different screens on a KDE desktop comprising several screens in form of a Nvidia Xinerama combination.

As long as I used 2 screens - one with a resolution of 1920x1200 and one with 2560x1440 - I really suffered a bit from the display discrepancies regarding font size. Especially when I wanted to open several windows of one and the same application - as 2 windows of Eclipse - on both screens or whenever I wanted to stretch one application (e.g. VMware) over the 2 screens. You may try to find compromises - but it will never be perfect.

However, in my present daily work with 3 screens - 2 with 2560x1440 and 1 with 1920x1200 - the different display of font sizes may become even an advantage: Just by moving an application to the lower resolution screen you get a better view on details. (But I admit, this is pure luxury, not only for development work.)

Nevertheless it would be fun if KDE in the future could provide a possibility to adjust font-sizes per screen in a Xinerama version.

Performance?

I do not know exactly how a GTS 450 graphics card performs. But my guess is that even for 2 screens (with 2560x1440) performance for the simple 3D effects of a plasma desktop should be no topic at all - even for this card. Actually, it is really frustrating that you cannot use high resolution HDMI with older graphics cards - despite the fact that the graphics card may support a combined resolution of 2 x 2560x1440 for DVI capable screens and provide a sufficient performance for it.

I should, however, mention that for three screens (2 x 2560x1440, 1x 1920x1200) my GTX 750 TI works constantly with high frequencies of both CPU and memory. The card never reduces this frequencies during normal use - so it will consume more electrical power than in a 2 screen situation. For 2 screens at 2560x1440 it always reduced frequencies to lower levels when only 2D applications were used on the desktop. However, despite constant high frequencies I never noticed any heat problem under normal conditions. The ventilators operate at basic speed and temperatures are between 36 and 40 ° Celsius.

With high resolution 3D games you may have a different experience - but if I play (which is seldom) I never play with extreme resolutions. So, actually I do not know how high resolution games perform on a (3D) KDE desktop.

Summary

Regarding the use of KDE with the DELL U2515H in my opinion you need not worry about font scalability and performance. You should worry more about the support of high resolution HDMI and display ports by both the physical card and the drivers for older Nvidia cards. A combination of a DELL U2515H with a screen of lower resolution will lead to problems - as visible font sizes may differ significantly.

Remark, added 17.12.2015:
Meanwhile I had the chance to test a Nvidia GTX 960 from Gigabyte together with 2 DELL U2515H connected via display port and a 1920x1200 screen connected via DVI. Works without any problems. And I see no problems with native Linux 3D OpenGL games as Red Eclipse or Xonotic at high resolutions so far. Temperatures around 43° Celsius.