TigerVNC / tigervnc

High performance, multi-platform VNC client and server
https://tigervnc.org
GNU General Public License v2.0
4.93k stars 917 forks source link

scaling for hidpi screens #1779

Open simoncasassus opened 3 weeks ago

simoncasassus commented 3 weeks ago

I would like to keep using tigervncviewer on my new laptop with a HDPI screen, running ubuntu 24.04, but vncviewer does not pick up the display scaling. From previous issues it seems that a work around might be to recompile the java version?

CendioOssman commented 3 weeks ago

Please see #369 for the native viewer. I'm not sure what the status is for the Java viewer. @bphinz?

simoncasassus commented 3 weeks ago

thank you, I should have kept on the thread in #369. I cannot find neither -dpi nor -ScalingFactor options for vncviewer (TigerVNC Viewer v1.13.1), but I did notice that the issue is a frequent problem among users. With -geometry 1920x1080 on the server side, the display is fine with a big screen or a normal DPI screen, but unusable on a laptop with HPDI. The solution viia gsettings had no effect. Any hint on how to run the Java version would be appreciated!

bphinz commented 3 weeks ago

You don't need to recompile the java viewer, just add a -Dsun.java2d.uiScale=200% before the -jar argument, eg:

java -Dsun.java2d.uiScale=200% -jar VncViewer.jar

I don't have a machine with a hidpi display to test it on but according to #1083 it works. You can also try using a float instead of XXX%

simoncasassus commented 3 weeks ago

thanks! The java version scales the gui perfectly. I could not get it to run properly though, I cannot figure out the relevant fields. I could run vinagre and remmina (none of which scale ok on hpdi), but VncViewer beats me. I run the native version like this: vncviewer -via @. rex:4 where rex is defined in my .ssh/config so I tried rex:5904 for the VNC server field, but i get invalid privatekey. Using the options to configure the tunnel return `ssh server not ready', and from the log I think that the port number for the tunnel is not being passed: (....) SSH command line: /usr/bin/ssh -f -L 43939:localhost:5904 @. sleep 20 (I am using VncViewer-1.11.0.jar)

On Tue, Jul 9, 2024 at 7:05 PM Brian Hinz @.***> wrote:

You don't need to recompile the java viewer, just add a -Dsun.java2d.uiScale=200% before the -jar argument, eg:

java -Dsun.java2d.uiScale=200% -jar VncViewer.jar

I don't have a machine with a hidpi display to test it on but according to

1083 https://github.com/TigerVNC/tigervnc/issues/1083 it works. You

can also try using a float instead of XXX%

— Reply to this email directly, view it on GitHub https://github.com/TigerVNC/tigervnc/issues/1779#issuecomment-2218897875, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFLKLDJQMY7ZGZLRZ7UQ3K3ZLRUCHAVCNFSM6AAAAABKR5OT36VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMJYHA4TOOBXGU . You are receiving this because you authored the thread.Message ID: @.***>

bphinz commented 3 weeks ago

Try this:

java -Dsun.java2d.uiScale=200% -jar VncViewer.jar -Tunnel -extSSH rex:4

1.11.0 is ancient and I don't recall if there were changes to the SSH tunnelling code but the latest nightly build is available here

simoncasassus commented 3 weeks ago

thanks again. It seems that there is a problem in passing the port number for the tunnel. There should be a -p 9942 in the ssh command. This port is read ok by ssh, from .ssh/config. But it is not picked up by VncViewer. Version 1.14 yields a similar log as 1.11:

java -Dsun.java2d.uiScale=200% -jar VncViewer-1.14.80.jar -Tunnel -extSSH rex:4

TigerVNC Java Viewer v1.14.80 (20240709) Built on 2024-07-09 at 02:49:54 Copyright (C) 1999-2024 TigerVNC Team and many others (see README.rst) See https://www.tigervnc.org for information on TigerVNC. VoidParameter: Bool parameter Tunnel: invalid value '-extSSH' VoidParameter: Bool parameter extSSH: invalid value 'rex:4' DecodeManager: Detected 12 CPU core(s) DecodeManager: Creating 4 decoder thread(s) Tunnel: SSH command line: /usr/bin/ssh -f -L 40841:rex:5904 @. sleep 20 @.) Password: com.tigervnc.rfb.Exception: SSH Tunnel not ready

On Tue, Jul 9, 2024 at 8:27 PM Brian Hinz @.***> wrote:

Try this:

java -Dsun.java2d.uiScale=200% -jar VncViewer.jar -Tunnel -extSSH rex:4

1.11.0 is ancient and I don't recall if there were changes to the SSH tunnelling code but the latest nightly build is available here http://tigervnc.bphinz.com/nightly/viewers/VncViewer-1.14.80.jar

— Reply to this email directly, view it on GitHub https://github.com/TigerVNC/tigervnc/issues/1779#issuecomment-2219154093, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFLKLDKKCELLA3YBDVI7CITZLR5X3AVCNFSM6AAAAABKR5OT36VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMJZGE2TIMBZGM . You are receiving this because you authored the thread.Message ID: @.***>

bphinz commented 3 weeks ago

oops, my bad - it's -Tunnel=1 -extSSH=1

simoncasassus commented 3 weeks ago

thanks. Unfortunately it seems the problem might be deeper, it still fails to load the port (-p 9942), complains ssh tunnel is not ready. I had a similar error with the GUI. Here is the log again (same as last time actually): java -Dsun.java2d.uiScale=200% -jar VncViewer-1.14.80.jar -Tunnel=1 -extSSH=1 rex:4 FileUtils: WARNING: ~/.vnc is deprecated, please consult 'man vncviewer' for paths to migrate to. FileUtils: WARNING: ~/.vnc is deprecated, please consult 'man vncviewer' for paths to migrate to.

TigerVNC Java Viewer v1.14.80 (20240709) Built on 2024-07-09 at 02:49:54 Copyright (C) 1999-2024 TigerVNC Team and many others (see README.rst) See https://www.tigervnc.org for information on TigerVNC. DecodeManager: Detected 12 CPU core(s) DecodeManager: Creating 4 decoder thread(s) Tunnel: SSH command line: /usr/bin/ssh -f -L 44909:rex:5904 @. sleep 20 @.) Password: com.tigervnc.rfb.Exception: SSH Tunnel not ready

On Tue, Jul 9, 2024 at 9:58 PM Brian Hinz @.***> wrote:

oops, my bad - it's -Tunnel=1 -extSSH=1

— Reply to this email directly, view it on GitHub https://github.com/TigerVNC/tigervnc/issues/1779#issuecomment-2219329493, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFLKLDKB4X3NARGBUUS7YYTZLSIL3AVCNFSM6AAAAABKR5OT36VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMJZGMZDSNBZGM . You are receiving this because you authored the thread.Message ID: @.***>

bphinz commented 3 weeks ago

The log does not show options like -p if they are specified in ~/.ssh/config but the external ssh command will still honour them. What's shown in the log is just the process and arguments spawned by the viewer. I haven't been able to replicate what you are seeing, I can open a tunnelled session over non-standard SSH ports just fine. It looks to me like you are getting a password prompt there - have you verified that you have SSH pubkey auth setup correctly?

bphinz commented 3 weeks ago

Indeed, if I add PreferredAuthentications=password to my ~/.ssh/config then I get a similar error & failure to connect

simoncasassus commented 1 week ago

Excuse the long delay. I finally got the java version to work, it scales very well and tigervncviewer is now usable on my HDPI screen. Great!

But the way I am running it is rather clumsy. Surely there must be a way to have it running similarly as in "vncviewer -via @.*** rex:4"? I confess that I got lost with the last two tips, on sharing ssh public keys. What I understood is that you suggest exchanging keys to avoid calling for a password.

The way I got VncViewer-1.14.80.jar to work is like this. First open a ssh tunnel, pointing locally to localhost:20001, and remotely to rex:5904: ssh -L 20001:127.0.0.1:5904 -p 9942 @.*** then open vncviewer with: java -Dsun.java2d.uiScale=200% -jar VncViewer-1.14.80.jar with the following fields: VNC Server: localhost:20001 Encryption: None SSH: None

On Tue, Jul 9, 2024 at 10:46 PM Brian Hinz @.***> wrote:

Indeed, if I add PreferredAuthentications=password to my ~/.ssh/config then I get a similar error & failure to connect

— Reply to this email directly, view it on GitHub https://github.com/TigerVNC/tigervnc/issues/1779#issuecomment-2219413673, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFLKLDOVKH3IVKXUQAB26DDZLSN75AVCNFSM6AAAAABKR5OT36VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMJZGQYTGNRXGM . You are receiving this because you authored the thread.Message ID: @.***>