Arduino icon indicating copy to clipboard operation
Arduino copied to clipboard

High DPI unusable on Linux

Open SvenDowideit opened this issue 7 years ago • 15 comments

Can't select the menu items, or edit with starting the v1.8.3 IDE on a HDPI screen on Linux (GNOME)

even changing the scaling factor doesn't help make the mouse usable.

the menus do at least work when using keyboard shortcuts, but my 8 year old has kinda lost interest after trying to work out how to make it useful.

I understand that its going to take quite a lot of work to resolve, but :/

SvenDowideit avatar Jul 08 '17 00:07 SvenDowideit

Click File > Preferences. Or hold the CTRL key and press the comma ',' key.

sc

PaulStoffregen avatar Jul 08 '17 16:07 PaulStoffregen

These definitely do work on my Ubuntu system using Arduino 1.8.3.

PaulStoffregen avatar Jul 08 '17 16:07 PaulStoffregen

That does a little. But the menus are still mostly unusable

SvenDowideit avatar Jul 09 '17 11:07 SvenDowideit

Does GNOME provides a setting for hi-dpi display? How is it set?

cmaglie avatar Jul 14 '17 11:07 cmaglie

@cmaglie not that we found - GNOME's claim to fame is to remove settings that users use - and even the secret settings tool didn't help.

SvenDowideit avatar Jul 31 '17 11:07 SvenDowideit

arduino_high_dpi_issue Not sure if this is the right place to post this, but on Ubuntu 17.10 using wayland, manual High DPI scaling works for everything except for the menu items. This isn't an issue that I have with other applications.

JamaicanMoose avatar Nov 02 '17 07:11 JamaicanMoose

As a shot into the dark: check your gtk-font-name value. I had gtk-font-name "Bitstream Vera Sans 8" in my ~/.gtkrc-2.0. Changing font size from 8 to 12 worked for me.

stapelberg avatar Sep 07 '19 08:09 stapelberg

In addition, it's possible to modify the menu font size: At the beginning of ./arduino script, just add xrandr --dpi xx with xx the value needed. In my case, it's 122. In the above script you can reset xrandr back to default DPI of 96 by adding the following line to the bottom: xrandr --dpi 96

Gaara14 avatar Nov 24 '19 09:11 Gaara14

as @stapelberg mentioned - his a workaround works ;-)
i posted a detailed way in #9170 basically create a custom .gtkrc-2.0 file with font size you like and start arduino with this file: GTK2_RC_FILES=my_arduino_gtkrc-2.0.conf arduino

s-light avatar Feb 07 '20 13:02 s-light

Still seeing this problem in PopOS 20.04 (ubuntu 20.04 base). Weird highlighting of text on mouseover, clicks can't register because everything is off in location.

Its basically unusable :(

cacois avatar Jul 20 '20 23:07 cacois

Do the following.

  1. Find the Arduino launch script, it could simply be /usr/bin/arduino or some other file called therein, for instance Arch has it at this path /usr/share/arduino/arduino.
  2. Find the line which actually launches java. For Arch this is the very last line in the file and it looks like this: "$JAVA" "${JAVA_OPTIONS[@]}" processing.app.Base "$@"
  3. Add the new line: JAVA_OPTIONS+=("-Dsun.java2d.uiScale=2") right before the line at point 2.

Everything (text, menu, icons...) will be scaled by a factor 2. You can tune the factor to your screen/taste, however only integers seems to be accepted.

For more details: https://wiki.archlinux.org/index.php/HiDPI#AWT/Swing

dpellegr avatar Sep 04 '20 09:09 dpellegr

The solution for me was to uninstall the flatpak (How the GUI package installer wanted to install things), and install Arduino IDE from the tarball directly according to: https://www.arduino.cc/en/guide/linux. This installed fine, and works perfectly on high DPI. No idea what was wrong with the flatpak install.

cacois avatar Sep 04 '20 13:09 cacois

Screenshot_20201216_165020

This is Arduino IDE 1.8.13 on OpenSUSE TW, installed from the distribution package, on X11, on a Thinkpad X1 with resolution 2560x1440, KDE display scaling set to 200%, and an empty ~/.arduino15/preferences.txt (Arduino default scaling preferences: scale 100% and autodetect enabled). Arduino IDE interface elements are unusably large, and its windows (such as the preferences window and library) are unusable.

If I disable autoscaling in the Arduino IDE and set scale to 50%, I get reasonably-sized text in the editor, but all UI elements are still enormous, their size doesn't seem to be influenced at all by anything I do in the Arduino preferences.

For whatever reason it does work when I set sun.java2d.uiScale to 1 in the /usr/bin/arduino script, even though there is no $JAVA_OPTIONS set anywhere else:

# Scale UI to 100% to avoid blown-up UI elements
JAVA_OPTIONS+=("-Dsun.java2d.uiScale=1")

"$JAVA" "${JAVA_OPTIONS[@]}" processing.app.Base "$@"

I wish in 2020 these things were somehow under control. I would switch to Wayland, but it doesn't support some other things I need.

phrxmd avatar Dec 16 '20 15:12 phrxmd

If all the tips above still not working for you just try using the flatpack version instead of the apt version. Flatpack

techtasie avatar Jan 09 '21 04:01 techtasie

Like others have reported, the preferences from within the GUI did not affect the menu for me (Debian bookworm/testing). Settings in gtkrc-2.0 did not do anything. Turns out, that recent versions of java switched to GTK3 for their GUI. What finally worked for me, was to set the shell variable GDK_SCALE: export GDK_SCALE=2 (Took the hint from https://wiki.archlinux.org/title/HiDPI#GUI_toolkits )

This is still a dirty hack. Icons and the corresponding tool tips render a bit mushy. This is to be expected, as each of their pixels turns into a tiny 2x2 square. However, the fonts in the main UI and in the menu render fine and crisp. I get a decent UI on a 4k, 24" monitor. :-)

Screenshot_arduino-IDE_with_GDK_SCALE

KaiMartin avatar Apr 27 '23 00:04 KaiMartin