gitpod-io / gitpod

The developer platform for on-demand cloud development environments to create software faster and more securely.
https://www.gitpod.io
GNU Affero General Public License v3.0
12.76k stars 1.23k forks source link

How to scale GUI apps depending on the preview size? #1239

Closed Kreyren closed 4 years ago

Kreyren commented 4 years ago

Current

image

Expected

image


I need some solution to make diagrams willing to change the software if there is something better.

jankeromnes commented 4 years ago

Hi @Kreyren, excellent point. I've been meaning to do something here for a while now, because I think it's quite unfortunately that the noVNC virtual desktop doesn't automatically resize with the preview pane.

One flagrant example is https://github.com/techwithtim/Hangman/, a really cool Python demo that can be started automatically in Gitpod, however the Hangman game window opens in the center of the virtual desktop, so it's not visible by default in the preview pane (unless you know that you should expand it or maximize it).

See also #303, in which we identified a promising noVNC option called resize: https://github.com/gitpod-io/gitpod/issues/303#issuecomment-463275662

However, it didn't work in our experiments, and we're not sure why. It would be great to resume these experiments, and see if this can be troubleshooted & fixed, because the current fixed-size virtual desktop in which you have to scroll around is just bad UX. (What's worse, scrolling in the virtual desktop also switches between 4 virtual desktops... which is super confusing and useless).

jankeromnes commented 4 years ago

More related to your question though, I think that once we have a virtual desktop with an auto-adaptive size, any GUI apps that's maximized should also follow the preview dimensions... hopefully.

Kreyren commented 4 years ago

Self-Diagnostics

Autoscale function?

noVNC apparently supports autoscale (https://github.com/novnc/noVNC/issues/763)

  1. Using vnc.html?resize=<scale | downscale | remote> does not seem to have an effect on this issue

  2. Appending &autoconnect=1 to vnc.html does not seem to have an effect on this issue.

Research required.

Kreyren commented 4 years ago

ping @jankeromnes Running https://6080-....gitpod.io/vnc.html with following configuration fixes the issue. Is that usable for gitpod implementation?

image

jankeromnes commented 4 years ago

Amazing, thank you so much @Kreyren for researching this! 🎉 🙏 💯

I don't have time to test it now, but if this works well we should probably make that the default behavior in Gitpod, e.g. via a noVNC launch.sh option in:

https://github.com/gitpod-io/workspace-images/blob/8a146a2cf092181723e63979e58605a413f84115/full-vnc/start-vnc-session.sh#L15

(assuming the desired configuration can be passed via CLI options there -- if not we'll have to find another way)

I can take a look at this tomorrow. Huge thanks again for driving this toward a fix, I've been waiting for an auto-resizing noVNC for so long now... 😲

JesterOrNot commented 4 years ago

@Kreyren Awesome 💯

JesterOrNot commented 4 years ago

I'll look into preparing a PR

jankeromnes commented 4 years ago

Thanks a ton for the fix @JesterOrNot! 🙏 🎉

I just merged your PR, so this should land in production as soon as the workspace-images master build is through (E.T.A ~30min I think).