Webtop: How do I set the default KasmVNC resolution

I am using the webtop:latest container (Alpine w/Xfce) and would like change the default resolution and disable client resizing. So far I have not found a way to do this with any of the documented environment variables and have had no luck mounting in my own kasmvnc.yaml file.

There doesn’t seem to be proper support for this, but I eventually figured out a way to do this.

Mounting /etc/kasmvnc.yaml (or ~/.vnc/kasmvnc.yaml) indeed doesn’t seem to work at all, it appears that all of those settings are ignored. Even inputting invalid YAML doesn’t seem to change anything…

You can set the resolution in XFCE’s display settings, but then the issue is that the KasmVNC client will always default the scaling mode to remote scaling, which will always change the resolution on connect. It should be possible to set both desktop.allow_resize: false and runtime_configuration.allow_client_to_override_kasm_server_settings: false, but since the settings file is ignored that doesn’t work…

To fix the scaling issue, you need to change the default to local scaling which can be done by editing /kclient/public/index.html. I use my own Dockerfile, which modifies that file automatically (you could also use a command/entrypoint script to change it when the container starts, if you want to use the original Docker image).

Below is my Dockerfile. It also installs OBS Studio and Chrome (feel free to remove those), which is why I’m using :ubuntu-xfce instead of :latest (Alpine), but it should work the same on Alpine. So, the last line is the only really relevant one:

FROM lscr.io/linuxserver/webtop:ubuntu-xfce

RUN apt-get update && apt-get install -y \
    fonts-liberation \
    obs-studio
RUN curl -Lo "/tmp/google-chrome.deb" \
    "https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb" \
    && dpkg -i "/tmp/google-chrome.deb" \
    && rm "/tmp/google-chrome.deb"

# Use local scaling by default (fixed resolution display)
RUN sed -i 's/resize=remote/resize=scale/g' /kclient/public/index.html

And a simplified version of my compose.yaml:

services:
  webtop-obs:
    container_name: webtop-obs
    hostname: webtop-obs
    image: webtop-obs
    pull_policy: build
    build:
      dockerfile: ./Dockerfile
    restart: unless-stopped
    security_opt:
      - seccomp:unconfined # Optional
    devices:
      - /dev/dri:/dev/dri # Optional GPU passthrough, for better OBS performance
    shm_size: "1gb" # Optional, but e.g. browsers might crash without it
    environment:
      - TZ=Europe/Helsinki
      - LC_ALL=en_US.UTF-8
      - PUID=1000
      - PGID=1000
      - TITLE=Webtop OBS
    volumes:
      - ./webtop-config:/config
      - /mnt/pool/share/obs-output:/obs-output
    ports:
      - 2590:3000 # HTTP
      - 2591:3001 # HTTPS