diff --git a/src/desktop-lite/devcontainer-feature.json b/src/desktop-lite/devcontainer-feature.json index 7c2549a0d..52adbae22 100644 --- a/src/desktop-lite/devcontainer-feature.json +++ b/src/desktop-lite/devcontainer-feature.json @@ -1,6 +1,6 @@ { "id": "desktop-lite", - "version": "1.2.4", + "version": "1.2.5", "name": "Light-weight Desktop", "documentationURL": "https://github.com/devcontainers/features/tree/main/src/desktop-lite", "description": "Adds a lightweight Fluxbox based desktop to the container that can be accessed using a VNC viewer or the web. GUI-based commands executed from the built-in VS code terminal will open on the desktop automatically.", @@ -47,6 +47,15 @@ ], "default": "5901", "description": "Enter a port for the desktop VNC server (TigerVNC)" + }, + "vncResolution": { + "type": "string", + "proposals": [ + "1440x768x16", + "1920x1080x32" + ], + "default": "1440x768x16", + "description": "Enter the vncResolution value for the desktop" } }, "init": true, diff --git a/src/desktop-lite/install.sh b/src/desktop-lite/install.sh index 5060f9210..a9a793c70 100755 --- a/src/desktop-lite/install.sh +++ b/src/desktop-lite/install.sh @@ -13,8 +13,8 @@ if [ "$VNC_PASSWORD" = "noPassword" ]; then unset VNC_PASSWORD fi NOVNC_PORT="${WEBPORT:-6080}" -VNC_PORT="${VNCPORT:-5901}" - +VNC_PORT="${VNCPORT:-5901}" +VNC_RESOLUTION="${VNCRESOLUTION:-1440x768x16}" INSTALL_NOVNC="${INSTALL_NOVNC:-"true"}" USERNAME="${USERNAME:-"${_REMOTE_USER:-"automatic"}"}" @@ -403,6 +403,7 @@ fi log "** SCRIPT EXIT **" EOF + if [ -n "${VNC_PASSWORD+x}" ]; then echo "${VNC_PASSWORD}" | vncpasswd -f > /usr/local/etc/vscode-dev-containers/vnc-passwd fi diff --git a/test/desktop-lite/scenarios.json b/test/desktop-lite/scenarios.json index d86b321fd..24672a671 100644 --- a/test/desktop-lite/scenarios.json +++ b/test/desktop-lite/scenarios.json @@ -4,5 +4,13 @@ "features": { "desktop-lite": {} } + }, + "test_vncResolution_config": { + "image": "ubuntu:noble", + "features": { + "desktop-lite": { + "vncResolution": "1920x1080x32" + } + } } } \ No newline at end of file diff --git a/test/desktop-lite/test_vncResolution_config.sh b/test/desktop-lite/test_vncResolution_config.sh new file mode 100644 index 000000000..18409505c --- /dev/null +++ b/test/desktop-lite/test_vncResolution_config.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +set -e + +# Optional: Import test library +source dev-container-features-test-lib + +# Check if xtigervnc & noVnc processes are running after successful installation and initialization +check_process_running() { + port=$1 + # Get process id of process running on specific port + PID=$(lsof -i :$port | awk 'NR==2 {print $2}') + GREEN='\033[0;32m'; NC='\033[0m'; RED='\033[0;31m'; YELLOW='\033[0;33m'; + if [ -n "$PID" ]; then + CMD=$(ps -p $PID -o cmd --no-headers) + echo -e "${GREEN}Command running on port $port: ${YELLOW}$CMD${NC}" + else + echo -e "${RED}No process found listening on port $port.${NC}" + exit 1 + fi +} + +check "Whether xtigervnc is Running" check_process_running 5901 +check "xtigervnc resolution" bash -c 'ps -x -ww | grep Xtigervnc | awk "{for(i=1;i<=NF;i++) if (\$i ~ /-geometry/) {print \$(i+1); exit}}"' +sleep 2 +check "Whether no_vnc is Running" check_process_running 6080 + +check "desktop-init-exists" bash -c "ls /usr/local/share/desktop-init.sh" +check "log-exists" bash -c "ls /tmp/container-init.log" +check "log file contents" bash -c "cat /tmp/container-init.log" + +# Report result +reportResults \ No newline at end of file