I have to work with Eclipse (version 4.32) again for a while. After two days of relatively intensive work, I am a bit frustrated. One reason is the small size of the icons – 16×16 px. Not only in the main icon taskbar. There are minuscule symbols elsewhere – e.g. in the bar on the left side of the editor section. Regarding e.g. the tiny symbol for code folding: You can almost not see the “+” or “-” symbols on a high resolution screen …
One can scale almost all font-sizes within Eclipse – but not such a basic thing as the icon/symbol size or the icon bar height.
I have three QHD screens (2560×1440) at my present workplace. At another site there are 2 4K screens. The following image can give you an impression for the QHD situation – if you have a QHD, UHD or 4K screen yourself and not zoomed the browser contents already. For screens with lower resolution see below.
Before you say this looks quite OK, check the following:
- Open this post on a desktop screen in a window wider than 800 px.
- Enforce normal content size size in your browser (no zoom! Ctrl-0).
- Get a natural distance to your working QHD, UHD or 4K monitor (like 80+ cm). In case you have a QHD screen you get already the right impression.
- Users who just have a monitor with a 1920×1200 resolution must in addition downscale their browser contents to around 80% (QHD) or 55% (UHD, 4K) to get the right impression of the problem. (After Ctrl-0)
- Folks with QHD get the right 4K impression by scaling down to 66%. (After Ctrl-0)
While for QHD the working conditions may still appear to be OK, you get a real problem for UHD and 4K resolutions. The font-size may still be OK (after having adapted it). The unadaptable symbol sizes, however, are far too small. At least in my opinion. But even on my standard QHD screens I personally do not feel comfortable after a while.
In this post I want to share some workarounds. The methods described may be interesting for other GTK applications, too. Keep in mind that the images in this post may give you a wrong impression if you zoomed the browser contents. But later on, when I demonstrate the effect of some measures, only relative sizes of fonts and icons are of interest.
Why does this problem of small icons and symbols in GTK applications irritate me?
- Elderly Linux users like me (66) often have problems with their eye-sight. But we nevertheless use high resolution screens for a variety of reasons. And we are very happy with the fact that we in general can adjust everything regarding fonts and icon sizes on a modern Linux desktop like KDE Plasma. At least for native Qt-applications. But our settings for KDE PLasma may not have any impact on GTK- and JVM-based applications.
- Native Qt-applications can be scaled individually and with any fractional factor – for graphic elements independently of fonts. Both on X11 and on Wayland. There is no such fine-tuned scaling for GTK applications. But there are some GTK applications which we KDE users need to use, too.
- Regarding GTK-based applications we very often have no influence on the icons used and icon sizes chosen by the developers. Gnumeric, gnote are examples. Libreoffice [LO] with Qt-interface, but even without is a counterexample. LO allows for a limited increase of the size of the icons and the icon bar. Also “geany” allows for a limited symbol sizing (2 steps). But Geany’s so called “big” icons are also much too small on a high resolution screen.
- Regarding Eclipse one might argue that the functionality of the icons in the icon bar can be achieved by commands and respective shortcut keys. However, this is not true for elements like the tiny buttons for collapsing code and annotation symbols in the left side bar of the editors. Neither is it true for symbols in other sections of the IDE interface like e.g. in the Mylyn task list.
- Regarding Eclipse the question of the chosen icon size is a rather old problem – in parts you find complaints on the Internet which go back in history for more than 10 years. High dpi monitors have existed now for a decade.
While (in parts commercial) IDEs like PyCharm really have done something in this respect, Eclipse is lagging behind. Which is a pity – not only for Python and PHP developers.
What we need in a future Eclipse version is a solution which allows for a flexible icon bar height and gives the user a choice between sets of icons with different dimensions. Such a solution is out of reach without a respective engagement of the Eclipse developers.
Although I am in general a fan of Eclipse this problem really makes me looking for alternatives these days. But a IDE selection will require some intensive testing first. What to do about this problem in the meantime?
I tried to figure out whether there are some workarounds. You indeed find some on the Internet. One problem is that those which suggest a directly manipulation of SWT in launcher scripts do no longer work. The philosophy obviously is that settings of a basic framework (like GTK) (used on the desktop) should be respected.
Workarounds for KDE/Plasma
What would be a good workaround? In my opinion it should be application specific. I.e., in the best case we would get a kind of scaling for graphical elements of our Eclipse application, but a scaling of the font-sizes could be suppressed. And other applications remain unaffected.
In the second best case our desktop display (“desktop screen”) is realized by a seamless combination of multiple monitor screens. Then we may have a chance to flexibly set some kind of fractional scaling for just one selected screen – the one on we will place the Eclipse UI. On the other screens we would work on with our sclabale Qt-applications. When I talk of screens below I mean a physical monitor screen and not the combined desktop display or “X screen” as it is sometimes called.
What kind of approach is not reasonable?
In case you have multiple screens and combined them to one big desktop display, it is not reasonable in my opinion to set a global integer or fractional scaling for the whole (virtual) desktop area – just because of the insufficient UIs of a few GTK/JVM-applications which you cannot avoid.
What is not working?
As we are on a KDE Plasma desktop one might think of a application scaling via Qt-methods. However, Eclipse is basically a JVM application using GTK via SWT. So, we would expect that scaling methods for native Qt applications will not work. And indeed: Something like we can do with e.g. dolphin like starting it by “QT_SCALE_FACTOR=1.5 QT_FONT_DPI=48 dolphin &” from the command line does not work for GTK-based applications. Neither on X11 nor on Wayland.
Workaround A on X11 – scaling the application UI
GTK has its own methods of scaling. See e.g [1], [2]. We have two environment variables which we can use on X11: “GDK_SCALE” and “GDK_DPI_SCALE“. The can be exported by a shell or used upon an application. For Eclipse we can execute the following command at a CLI prompt:
myself:/ecl> GDK_DPI_SCALE=0.5 GDK_SCALE=2 taskset -c 0-3 ./eclipse &
(The use of taskset is of course optional). The fractional value for the GDK_DPI_SCALE compensates the overall scaling of the window for the fonts. They keep their old size. This is a well known solution; see [1] to [5].
The problem with this solution is the following: For GTK3 and GTK4 (and since Java 9 for JVM-based applications) GDK_SCALE is only working with integer values. There is no choice of a fractional scaling. See e.g. [1] and the section on GTK3/GDK3 therein. This limitation may create problems for some applications on screens with intermediate high resolutions, i.e. better than 1920×1200 screens, but below 4K. Like QHD screens.
In the case of Eclipse with its minuscule symbols, it does however help on my 2560×1440 screens. The fonts appear nevertheless sharp and crispy, especially with the DevStyle themes (of Genuitec; see [6] ). The following image gives you an impression. To get a comparison with the image above I had to reduce the 3 IDE sections to fill just 800px in width. Of course, I have much more horizontal space on the screen. To get the right impression on your browser interface, the same rules as described above hold. Readers with a low resolution monitor may have to zoom out, i.e. to reduce the contents of the browser.
So, for me this is a valid workaround solution for Plasma on X11. Users with a 4K screen may use a scaling factor of GDK_SCALE=3 and adapt the font-scaling in addition.
By the way: The “devstyle” themes allow for an adaption of the “explorer fonts” and thereby also of the fonts used in the outline section 🙂 .
However, this approach does not work on Wayland …
Workaround B on X11 – set a fractional scaling factors for a screen
KDE offers you a global (fractional) scaling of all screens composing your desktop (see e.g [7]). You get to the respective option via “systemsettings” >> “Display Configuration”. On my German desktop the relevant part of the configuration looks like:
But what if you want a screen specific scaling in a multi-monitor environment? Then you can use XrandR; see e.g. [8] and [9]. Although this is not recommended and may have side effects. In particular when you apply the following commands during an active KDE desktop session. E.g. your well positioned taskbar may disappear. The reason is that you kind of zoom in into your screen – and some parts move out of the afterward displayed region.
However, if you nevertheless want to try it out, first find out how the specific monitor you want to deal with is named. This can be done by evaluating the output of the “xrandr”-command in a terminal window. In the following example I want to change the scaling of a monitor named DP-0 (DP stands for Display Port). So execute:
myself:/ecl> xrandr .... myself:/ecl> xrandr --output DP-0 --scale 0.8x0.8
Note that you need to use scaling factors < 1 to zoom in.
You may experience that your monitors go blank, but come up afterward with the new configuration. However, this workaround has a major disadvantage, too: The Eclipse UI appears blurry afterwards. Test it yourself. So, this is no really good option.
Workaround on Wayland – fractional scaling of a specific monitor screen
Let us turn to KDE Plasma on Wayland. The workaround there will be to reserve one of my monitor screens for Eclipse and use fractional scaling there. Wayland and its compositor are meanwhile prepared for fractional scaling of specific screens in a multi-monitor environment – without the general side effects one experiences on X11 with xrandr based scaling.
On Opensuse Leap systems it is easy to change to Wayland via options on the SDDM display manager (or another major display manager). The “plasma5-wayland-session” package must be installed. This should also hold on other distributions (the package name may be a bit different). On the display manager we choose “plasma (wayland)“.
You can afterward check whether Wayland is running via executing the command “echo “$XDG_SESSION_TYPE” on the command line of a terminal window; the answer should be “wayland” (see e.g. [10]):
myself:/ecl> echo "$XDG_SESSION_TYPE" wayland myself:/ecl>
KDE’s “systemsettings” may also provide some “system information”. I show a section of the respective window below:
Does Wayland work? I am happy to report that – with the latest updates and backports – a Plasma session on Wayland is a relatively pleasant experience on Opensuse Leap 15.5. Some applications (like Chromium, Opera or Libreoffice on scaled screens) must be started with special parameters or env variables. But this a topic for another forthcoming post. Relevant in our present context is that KDE’s systemsettings on Wayland now offers an option to apply a fractional scaling for a selected screen – without changing the scaling of the other monitor screens.
This approach to work with applications having to small graphical elements is convenient as Wayland itself cares about it – if the application is Wayland ready (or can be handled by XWayland).
For a 125% scaling of my leftmost screen I get something like this after having started Eclipse there:
I leave it to the reader to test other scaling factors. Regarding the icons – already better. For 150% maybe ideal. The problem is that all the editor and explorer fonts in Eclipse, of course, scale too – fractional scaling on the screen works like an overall zooming in, but with a better compensation for font sharpness. So, do we need to diminish our fonts now in Eclipse by down scaling them with the help of Eclipse preference settings?
No, there is a better solution! GDK_SCALE does not work in Wayland. (You can test it yourself.) However, GDK_DPI_SCALE still works. So, we can actually combine fractional screen scaling for a specially selected monitor with GTK font-scaling. So, in my case I could use a 125% scaling of the screen, but e.g. an 80% scaling of the fonts via
myself:/ecl> GDK_DPI_SCALE=0.8 taskset -c 0-3 ./eclipse & myself:/ecl>
This gave me:
This is something I can live with. For other resolutions and applications you can try other combinations.
Off topic: Bugs in some applications as e.g. in the present LO version, may lead to an incorrect display after the scaling of a screen. But even for this problem there is a workaround. Wait for the next post in this blog.
Conclusion
Eclipse as a GTK-based application has too small icons and symbols for really high dpi screens. The size is fixed and we ave no choice to select bigger icons. As long as the Eclipse developers do not provide options for a flexible adaption of the icon sizes (and of all fonts) we have to use application scaling or screen scaling as workarounds. For application scaling an independent fractional scaling of the graphical elements and a (separate) scaling of the fonts font scaling would be ideal. Unfortunately, GTK3/4 no longer allows for a fractional scaling of the graphical elements. Qt is much more flexible in this respect – both on Wayland andX11. If integer scaling factors for GTK-applications are not sufficient in your environment, changing to Plasma on Wayland may be an option. there you can combine a fractional scaling for a selected screen with separate font scaling for GTK applications via GDK_DPI_SCALE.
Links and Literature
[1] ArchWiki on HiDPI: https://wiki.archlinux.org/ title/ HiDPI
[2] Gtk – 3.0/ 4.0 documentation: https://docs.gtk.org/ gtk3/ x11.html and https://docs.gtk.org/ gtk4/ x11.html
[3] Discussion regarding scaling at stackexchange: https://unix.stackexchange.com/ questions/ 596887/ how-to-scale-the-resolution-display-of-the-desktop-and-or-applications
[4] 8 year old question at stackexchange: “Eclipse Neon icon size in Ubuntu 16.04 hidpi“.
While the answer regarding SWT does not work any longer, see the answer of “Zoltan” in the discussion.
[5] Similar problem regarding steam: “Steam Scaling & The GDK_SCALE=2 Mystery-SOLVED”
[6] DevStyle themes for Eclipse (provided by Genuitec): See e.g. the Eclipse market place for darkest dark theme devstyle
[7] Post of Ruben Schade on his blog: Retina, HiDPI scaling in KDE Plasma
[8] Post on scaling at discuss.kde.org: https://discuss.kde.org/ t/ kde-fractional-scaling-on-only-one-monitor/ 3390/7
[9] Question on scaling at unix.stackexchange.com: “How to scale the resolution/display of the desktop and/or applications?”
[10] V. Gite on www.cyberciti.biz: “How to check for Wayland or Xorg (X11) Linux desktop”