Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic resizing of the display size #115

Closed
olberger opened this issue Apr 12, 2019 · 19 comments
Closed

Dynamic resizing of the display size #115

olberger opened this issue Apr 12, 2019 · 19 comments

Comments

@olberger
Copy link
Contributor

olberger commented Apr 12, 2019

AFAIU, the display size is calculated initially, but it the browser's window is resized later, the X desktop won't adjust (well, noVNC has an option to stretch the rendering, etc.).

Would it be possible to use RandR to perform that, along the lines of https://stackoverflow.com/a/46295657 ?

@dennisvanderpool
Copy link

dennisvanderpool commented Apr 13, 2019

I have the same issue as well.
For me the resolution only is okay if i start the container with -e 1920x1080 or -e 2560x1440 so it's fixed.
With the autodetection i get strange resolutions and i want everything to run full screen in native resolution.
As i will be connecting from multiple devices with different screen resolutions any solution that allows me to change the resolution without creating container again with docker run is okay for me. I don't want to run the container everytime again as i need to reinstall and reconfigure it.

I know a container is meant to be stateless, but for my use case for the desktop that isn't that handy.

@dennisvanderpool
Copy link

dennisvanderpool commented Apr 14, 2019

I've got another one container desktop running, named Kasm web which has a working resize and is also based on noVNC and works with xrandr. Maybe we can peek there what they did?

https://hub.docker.com/u/kasmweb

You can also easily try it on their website:
https://www.kasmweb.com/

@fcwu
Copy link
Owner

fcwu commented Apr 14, 2019

I implemented resize when I worked at QNAP that is not based on xrandr. You may imagine user resize browser window by drag & drop and the screen resolution must change to fit browser window size. It's not a fixed resolution such as 1920x1080, 1280x720. It may be an arbitrary size like 1234x123. So writing a fixed resoulution in X configuration is not a good choice.

Alternatively, I run xvfb with a big size like 4096x3??? (4k) and a customized window manager that monitor all windows in it. When any window is out of visible range, window manager will move it to visible range.

@dennisvanderpool
Copy link

For me it would be great if we have an option, autosize or fixed. I'm okay with just the few fixed resolutions i use:
1920x1080
2560x1440
3440x1440
I even don't remind restarting the docker container, i just don't want to get it destroyed.

@fcwu
Copy link
Owner

fcwu commented Apr 15, 2019

@dennisvanderpool restart the docker container leads resizing xvfb. Here is my steps

  1. Close browser's window
  2. docker restart
  3. Open browser again

In step3, it will call HTTP API api/reset?w=xxx&h=xxxx to resize

@tafulop
Copy link

tafulop commented Aug 17, 2019

@fcwu first of all, thanks for this great container, but I am experiencing some issues with it. I have tried to set the resolution with the RESOLUTION environment variable as it is stated in the How To, but it just simply does not work. I have tried the following things:

Start:
docker run -it --rm -p 6080:80 -p 5900:5900 -e RESOLUTION=1920x1080 ct2034/vnc-ros-kinetic-full

1st attempt:
Log in with Remmina -> resolution was 1024*768

2nd attempt (after recreating the container):
Login with Google Chrome -> resolution got reset to the usable space in the browser, which was 1920x949

Is this just me, or is it really not working properly?

@fcwu
Copy link
Owner

fcwu commented Aug 18, 2019

@tafulop open another issue.

@fcwu
Copy link
Owner

fcwu commented Aug 18, 2019

I have no plan to support this by RandR, because it's possible to change size by resizing browser window.

However, it's possible to change resolution without destroying container.

@fcwu
Copy link
Owner

fcwu commented Aug 19, 2019

I will create an endpoint /resize to restart xvfb to fitting current browser's window size. If someone would like to update screen size, append resize to original URL, for example, http://127.0.0.1:6080/resize. After updated, it will redirect to vnc page.

@pbek
Copy link

pbek commented Feb 10, 2020

I will create an endpoint /resize to restart xvfb to fitting current browser's window size. If someone would like to update screen size, append resize to original URL, for example, http://127.0.0.1:6080/resize. After updated, it will redirect to vnc page.

@fcwu, thank you for this wonderful container, it fits all my Desktop needs (and I'm writing this comment from it 😁)!
Does the /resize endpoint already work? (I saw it in the source code). But I get a 404 error from nginx if I hit it. Is there another way to resize the resolution in the running container?

@fcwu
Copy link
Owner

fcwu commented Feb 23, 2020

it works

$ curl http://127.0.0.1:6080/resize
<html><head><script type = "text/javascript">var h=window.location.href;window.location.href=h.substring(0,h.length-6);</script></head></html>

@pbek
Copy link

pbek commented Feb 23, 2020

Strange if I connect from inside the container I get

curl http://127.0.0.1:80/resize
<html>
<head><title>404 Not Found</title></head>
<body bgcolor="white">
<center><h1>404 Not Found</h1></center>
<hr><center>nginx/1.14.0 (Ubuntu)</center>
</body>
</html>

and from outside it's the same

curl -u the-user https://the-domain.com/resize
Enter host password for user 'the-user':
<html>
<head><title>404 Not Found</title></head>
<body bgcolor="white">
<center><h1>404 Not Found</h1></center>
<hr><center>nginx/1.14.0 (Ubuntu)</center>
</body>
</html>

in the nginx logs I get

172.28.0.1 - the-user [23/Feb/2020:16:13:58 +0000] "GET /resize HTTP/1.1" 404 178 "-" "curl/7.58.0"

@pbek
Copy link

pbek commented Feb 23, 2020

But I'm using dorowu/ubuntu-desktop-lxde-vnc:bionic-lxqt.

@pbek
Copy link

pbek commented Feb 23, 2020

In docker compose I run

  ubuntu-desktop-lxqt-vnc:
    build: ./ubuntu-desktop-lxqt-vnc
    restart: unless-stopped
    volumes:
    - /dev/shm:/dev/shm
    - ./ubuntu-desktop-lxqt-vnc/home:/home
    - ./ubuntu-desktop-lxqt-vnc/ssl:/etc/nginx/ssl
    ports:
    - "127.0.0.1:6080:80"
    environment:
    - USER=the-user
    - PASSWORD=the password

with a ubuntu-desktop-lxqt-vnc/Dockerfile

FROM dorowu/ubuntu-desktop-lxde-vnc:bionic-lxqt

RUN sudo sed -i 's|http://tw.|http://de.|g' /etc/apt/sources.list
RUN sudo apt update
RUN sudo apt -y install dirmngr
RUN sudo apt-key adv --fetch-keys https://s3.eu-central-1.amazonaws.com/jetbrains-ppa/0xA6E8698A.pub.asc
RUN echo "deb http://jetbrains-ppa.s3-website.eu-central-1.amazonaws.com bionic main" | sudo tee /etc/apt/sources.list.d/jetbrains-ppa.list > /dev/null
RUN sudo add-apt-repository -y ppa:pbek/qownnotes
RUN sudo add-apt-repository -y ppa:fish-shell/release-3
RUN sudo add-apt-repository -y ppa:nextcloud-devs/client
RUN sudo add-apt-repository -y ppa:eugenesan/ppa
RUN sudo add-apt-repository -y ppa:phoerious/keepassxc
RUN sudo add-apt-repository -y ppa:peek-developers/stable

RUN sudo apt -y upgrade
RUN sudo apt -y install qownnotes fish nextcloud-client less mc htop git smartgithg qtcreator qt5-default g++ qttools5-dev build-essential qtdeclarative5-dev libqt5svg5-dev qttools5-dev-tools libqt5xmlpatterns5-dev libqt5websockets5-dev keepassxc clion phpstorm vim telnet nmap inetutils-ping peek xscreensaver

@fcwu
Copy link
Owner

fcwu commented Feb 23, 2020

bionic-lxqt is not rebase to the latest backend service. Then, I do git rebase but icon/theme is broken, so...

@pbek
Copy link

pbek commented Feb 23, 2020

Oh, I see 😿

@lakemike
Copy link

lakemike commented Aug 8, 2021

Hi all, I could successfully use the "/resize" endpoint with the bionic image. When I updated to focal today, I noticed that "/resize" is not working. Or at least in my installation, where this is running behind traefik as reverse proxy, I receive an error message "404" from nginx.
Is "/resize" still supported in the latest focal image?

@falcorocks
Copy link

@lakemike in #231 we are struggling to deploy this behind a reverse proxy. Can you share your setup there?

@wings-of-gold
Copy link

@dennisvanderpool restart the docker container leads resizing xvfb. Here is my steps

  1. Close browser's window
  2. docker restart
  3. Open browser again

In step3, it will call HTTP API api/reset?w=xxx&h=xxxx to resize

this is a good method

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants