compose-multiplatform
compose-multiplatform copied to clipboard
Linux hidpi scaling
UI is not upscaled properly on some Linux desktops. Would be useful if compose-jb could use same logic as Intellij uses (ref)
Linux jvm 14 Gnome 3.38 wayland
Intellij show hidpi info
content:
Per-monitor DPI-aware : enabled Monitor resolution : 1920x1080 Monitor scale : 2.0 User (IDE) scale : 1.0 Xft.DPI : 192 GSettings scale factor : undefined GDK_SCALE : undefined GDK_DPI_SCALE : undefined
Is there any workaround for now?
Is there any workaround for now?
Only manually set system parameter -Dsun.java2d.uiScale=2.0
Tried specifying "-Dsun.java2d.uiScale=2.0" in IDEA Run Configurations VM options, does not work.
System properties which are set by IDEA Run Configuration are visible only to gradle.
If they should be visible to application, we need to define them in build.gradle.kts:
compose.desktop {
application {
jvmArgs("-Dsun.java2d.uiScale=2.0")
System properties which are set by IDEA Run Configuration are visible only to gradle.
If they should be visible to application, we need to define them in build.gradle.kts:
compose.desktop { application { jvmArgs("-Dsun.java2d.uiScale=2.0")
Still don't work on Linux
Still don't work on Linux
We fixed DPI on some Linux'es some versions ago. But it seems that doesn't help in Fedora, probably in KDE-based distro's, and probably in Wayland
By the way, don't call any java.swing.*
, java.awt.*
functions before calling application
or the old Window
.
Otherwise DPI will not be set.
If you call these kind of functions, you should call configureSwingGlobalsForCompose()
explicitly before any code, in the beginning of the fun main() { }
Still don't work on Linux
We fixed DPI on some Linux'es some versions ago. But it seems that doesn't help in Fedora, probably in KDE-based distro's, and probably in Wayland
I'm using Ubuntu with Gnome, all latest, I tried the simplest app created by IDEA, the "Hello, Desktop" button is so small in both Wayland and X11. And I added "jvmArgs("-Dsun.java2d.uiScale=2.0")" like you said, then noting happened. Might be something wrong? And I tried your example app "todoapp", it scaled correctly, but I can't find any code about hidpi in the project, even jvmArgs, why?
I tried the simplest app created by IDEA And I tried your example app "todoapp", it scaled correctly
IDEA uses the old version 0.4.0
, and todoapp uses 1.0.0-alpha1-rc3
.
I tried the simplest app created by IDEA And I tried your example app "todoapp", it scaled correctly
IDEA uses the old version
0.4.0
, and todoapp uses1.0.0-alpha1-rc3
.
Now we find the problem. How could I update the version?
Now we find the problem. How could I update the version?
Change it as described here for desktop-only project or here for MPP project.
(don't add COMPOSE_TEMPLATE_COMPOSE_VERSION, it is only for our CI)
I tried the simplest app created by IDEA And I tried your example app "todoapp", it scaled correctly
IDEA uses the old version
0.4.0
, and todoapp uses1.0.0-alpha1-rc3
.Now we find the problem. How could I update the version?
I found it, in build.gradle.kts->plugins. Maybe I should update my IDEA to preview version for always getting default latest compose version.
Now we find the problem. How could I update the version?
Change it as described here for desktop-only project or here for MPP project.
(don't add COMPOSE_TEMPLATE_COMPOSE_VERSION, it is only for our CI)
Thank you very much.
Maybe I should update my IDEA to preview version for always getting default latest compose version.
IDEA will be always behind the latest version of Compose, even Preview version (but it gets the updated version faster, we usually change it after releasing the stable version of Compose)
I can't get it to scale on Ubuntu 21.04. I've tried the todo app and some of the suggestions here. It always looks tiny!
The IDEA itself looks fine though.
Why simply reading the output of xrdb -q | grep Xft.dpi
and setting the scale accordingly is not an option anymore?
At least until some better option arrive.
GDK_SCALE=2 as an environment variable will help.
Nah it doesn't. Maybe because im under KDE.
BTW with wayland scaling is ok out of the box. That was Kubuntu 22.04
Ok, for me it helped under debian testing (bookworm) wayland Gnome
This is an issue only when running in debugging mode for me, when i run this in release mode it works properly ie :
./gradlew runRelease
== works properly.
This was on PopOs with wayland
./gradlew runRelease == works properly.
This was on PopOs with wayland
Ditto for me on Fedora 37 Wayland. The normal interactive run button in IntelliJ renders an application very small.
FYI, I believe scaling used to be ok in Jetbrains Toolbox (which is written with Compose itself) until a few versions ago, but now the toolbox fonts render ridiculously small compared to other windows on a 2560x1440 pixel display. I'm also on Fedora 38 on Wayland.
Hi everyone, I was facing the same issue whenever I'm switch from my monitors to laptop screen. Having read the above comment, running with gradlew runRelease
works for me. So my plan is work on this issue and make a PR however no clue as to where to begin from like I have no clue on compose nor much on wayland, could somebody help me out with references if they have worked on this similar issue?