From 9942b51f0278271968fc62763d63db84b77e7585 Mon Sep 17 00:00:00 2001 From: phorcys420 <57866459+phorcys420@users.noreply.github.com> Date: Wed, 24 Jul 2024 13:04:01 +0000 Subject: [PATCH 1/6] feat(desktop-lite): make fluxbox optional --- src/desktop-lite/NOTES.md | 2 ++ src/desktop-lite/devcontainer-feature.json | 5 +++++ src/desktop-lite/install.sh | 26 +++++++++++++++------- 3 files changed, 25 insertions(+), 8 deletions(-) diff --git a/src/desktop-lite/NOTES.md b/src/desktop-lite/NOTES.md index 924ce9b6e..5cc9ccf2b 100644 --- a/src/desktop-lite/NOTES.md +++ b/src/desktop-lite/NOTES.md @@ -33,6 +33,8 @@ If you add custom content to your base image or a Dockerfile in this location, t See the [Fluxbox menu documentation](http://www.fluxbox.org/help/man-fluxbox-menu.php) for format details. More information on additional customization can be found in Fluxbox's [help](http://www.fluxbox.org/help/) and [general](http://fluxbox.sourceforge.net/docbook/en/html/book1.html) documentation. +If you do not want to use Fluxbox, then you can set `installFluxbox` to `false` and install your own window manager. + ## Resolving crashes If you run into applications crashing, you may need to increase the size of the shared memory space allocated to your container. For example, this will bump it up to 1 GB in `devcontainer.json`: diff --git a/src/desktop-lite/devcontainer-feature.json b/src/desktop-lite/devcontainer-feature.json index 417787c51..276692560 100644 --- a/src/desktop-lite/devcontainer-feature.json +++ b/src/desktop-lite/devcontainer-feature.json @@ -47,6 +47,11 @@ ], "default": "5901", "description": "Enter a port for the desktop VNC server (TigerVNC)" + }, + "installFluxbox": { + "type": "boolean", + "default": true, + "description": "Whether or not to install Fluxbox (set to false if you plan on using a different desktop environment)" } }, "init": true, diff --git a/src/desktop-lite/install.sh b/src/desktop-lite/install.sh index ef8b603c6..eabd5bb2c 100755 --- a/src/desktop-lite/install.sh +++ b/src/desktop-lite/install.sh @@ -18,12 +18,13 @@ VNC_PORT="${VNCPORT:-5901}" INSTALL_NOVNC="${INSTALL_NOVNC:-"true"}" USERNAME="${USERNAME:-"${_REMOTE_USER:-"automatic"}"}" +INSTALL_FLUXBOX="${INSTALLFLUXBOX:-"true"}" + WEBSOCKETIFY_VERSION=0.10.0 package_list=" tigervnc-standalone-server \ tigervnc-common \ - fluxbox \ dbus-x11 \ x11-utils \ x11-xserver-utils \ @@ -88,6 +89,7 @@ if [ "${USERNAME}" = "auto" ] || [ "${USERNAME}" = "automatic" ]; then elif [ "${USERNAME}" = "none" ] || ! id -u ${USERNAME} > /dev/null 2>&1; then USERNAME=root fi + # Add default Fluxbox config files if none are already present fluxbox_apps="$(cat \ << 'EOF' @@ -197,7 +199,12 @@ else package_list="${package_list} tilix" fi -# Install X11, fluxbox and VS Code dependencies +# If we want to install Fluxbox, then add it to the list of pacakges +if [ "${INSTALL_FLUXBOX}" = "true" ]; then + package_list="${package_list} fluxbox" +fi + +# Install X11 and VS Code dependencies check_packages ${package_list} # if Ubuntu-24.04, noble(numbat) found, then will install libasound2-dev instead of libasound2. @@ -377,7 +384,7 @@ screen_geometry="\${VNC_RESOLUTION%*x*}" screen_depth="\${VNC_RESOLUTION##*x}" # Check if VNC_PASSWORD is set and use the appropriate command -common_options="tigervncserver \${DISPLAY} -geometry \${screen_geometry} -depth \${screen_depth} -rfbport ${VNC_PORT} -dpi \${VNC_DPI:-96} -localhost -desktop fluxbox -fg" +common_options="tigervncserver \${DISPLAY} -geometry \${screen_geometry} -depth \${screen_depth} -rfbport ${VNC_PORT} -dpi \${VNC_DPI:-96} -localhost -fg" if [ -n "\${VNC_PASSWORD+x}" ]; then startInBackgroundIfNotRunning "Xtigervnc" sudoUserIf "\${common_options} -passwd /usr/local/etc/vscode-dev-containers/vnc-passwd" @@ -404,11 +411,14 @@ if [ -n "${VNC_PASSWORD+x}" ]; then fi chmod +x /usr/local/share/desktop-init.sh /usr/local/bin/set-resolution -# Set up fluxbox config -copy_fluxbox_config "/root" -if [ "${USERNAME}" != "root" ]; then - copy_fluxbox_config "/home/${USERNAME}" - chown -R ${USERNAME} /home/${USERNAME}/.Xmodmap /home/${USERNAME}/.fluxbox +# If we installed Fluxbox, set up fluxbox config +if [ "${INSTALL_FLUXBOX}" = "true" ]; then + copy_fluxbox_config "/root" + + if [ "${USERNAME}" != "root" ]; then + copy_fluxbox_config "/home/${USERNAME}" + chown -R ${USERNAME} /home/${USERNAME}/.Xmodmap /home/${USERNAME}/.fluxbox + fi fi # Clean up From e7d45dec7289284cf2d38c32770ec7d06100770c Mon Sep 17 00:00:00 2001 From: phorcys420 <57866459+phorcys420@users.noreply.github.com> Date: Sun, 4 Aug 2024 20:40:42 +0000 Subject: [PATCH 2/6] feat(desktop-lite): add test scenarios --- test/desktop-lite/scenarios.json | 19 +++++++++++++++++++ test/desktop-lite/test.sh | 1 - test/desktop-lite/with_fluxbox.sh | 8 ++++++++ test/desktop-lite/without_fluxbox.sh | 8 ++++++++ 4 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 test/desktop-lite/scenarios.json create mode 100644 test/desktop-lite/with_fluxbox.sh create mode 100644 test/desktop-lite/without_fluxbox.sh diff --git a/test/desktop-lite/scenarios.json b/test/desktop-lite/scenarios.json new file mode 100644 index 000000000..21784479c --- /dev/null +++ b/test/desktop-lite/scenarios.json @@ -0,0 +1,19 @@ +{ + "with_fluxbox": { + "image": "mcr.microsoft.com/devcontainers/base:ubuntu-20.04", + "features": { + "desktop-lite": { + "installFluxbox": true + } + } + }, + + "without_fluxbox": { + "image": "mcr.microsoft.com/devcontainers/base:ubuntu-20.04", + "features": { + "desktop-lite": { + "installFluxbox": false + } + } + } +} diff --git a/test/desktop-lite/test.sh b/test/desktop-lite/test.sh index 5d11dd424..0e5715889 100755 --- a/test/desktop-lite/test.sh +++ b/test/desktop-lite/test.sh @@ -26,7 +26,6 @@ checkOSPackage() { check "desktop-init-exists" bash -c "ls /usr/local/share/desktop-init.sh" check "log-exists" bash -c "ls /tmp/container-init.log" -check "fluxbox-exists" bash -c "ls -la ~/.fluxbox" . /etc/os-release if [ "${ID}" = "ubuntu" ]; then diff --git a/test/desktop-lite/with_fluxbox.sh b/test/desktop-lite/with_fluxbox.sh new file mode 100644 index 000000000..5ccae42dd --- /dev/null +++ b/test/desktop-lite/with_fluxbox.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +set -e + +# Optional: Import test library +source dev-container-features-test-lib + +check "fluxbox exists" bash -c "ls -la ~/.fluxbox" \ No newline at end of file diff --git a/test/desktop-lite/without_fluxbox.sh b/test/desktop-lite/without_fluxbox.sh new file mode 100644 index 000000000..db15ee6ee --- /dev/null +++ b/test/desktop-lite/without_fluxbox.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +set -e + +# Optional: Import test library +source dev-container-features-test-lib + +check "fluxbox does not exist" bash -c "! ls -la ~/.fluxbox" \ No newline at end of file From 657c7cfeb45e3c6082ed264cd0a912187885fdd9 Mon Sep 17 00:00:00 2001 From: Phorcys <57866459+phorcys420@users.noreply.github.com> Date: Tue, 13 Aug 2024 22:51:43 +0200 Subject: [PATCH 3/6] chore: remove space in `install.sh` Co-authored-by: Samruddhi Khandale --- src/desktop-lite/install.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/src/desktop-lite/install.sh b/src/desktop-lite/install.sh index eabd5bb2c..a75a4563a 100755 --- a/src/desktop-lite/install.sh +++ b/src/desktop-lite/install.sh @@ -17,7 +17,6 @@ VNC_PORT="${VNCPORT:-5901}" INSTALL_NOVNC="${INSTALL_NOVNC:-"true"}" USERNAME="${USERNAME:-"${_REMOTE_USER:-"automatic"}"}" - INSTALL_FLUXBOX="${INSTALLFLUXBOX:-"true"}" WEBSOCKETIFY_VERSION=0.10.0 From 1c50d70c6fbd41ac895f462367449fff34741442 Mon Sep 17 00:00:00 2001 From: Phorcys <57866459+phorcys420@users.noreply.github.com> Date: Tue, 13 Aug 2024 22:51:59 +0200 Subject: [PATCH 4/6] chore: clarify README.md Co-authored-by: Samruddhi Khandale --- src/desktop-lite/NOTES.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/desktop-lite/NOTES.md b/src/desktop-lite/NOTES.md index 5cc9ccf2b..c6c48cbae 100644 --- a/src/desktop-lite/NOTES.md +++ b/src/desktop-lite/NOTES.md @@ -33,7 +33,7 @@ If you add custom content to your base image or a Dockerfile in this location, t See the [Fluxbox menu documentation](http://www.fluxbox.org/help/man-fluxbox-menu.php) for format details. More information on additional customization can be found in Fluxbox's [help](http://www.fluxbox.org/help/) and [general](http://fluxbox.sourceforge.net/docbook/en/html/book1.html) documentation. -If you do not want to use Fluxbox, then you can set `installFluxbox` to `false` and install your own window manager. +If you prefer not to use Fluxbox, you can set the `installFluxbox` Feature option to `false` and install your own window manager. ## Resolving crashes From 3d1e9fddc1d49161d8035f0d6f0f0d15467df25b Mon Sep 17 00:00:00 2001 From: Phorcys <57866459+phorcys420@users.noreply.github.com> Date: Tue, 13 Aug 2024 22:53:20 +0200 Subject: [PATCH 5/6] chore: fix incorrect capitalization in NOTES.md --- src/desktop-lite/NOTES.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/desktop-lite/NOTES.md b/src/desktop-lite/NOTES.md index c6c48cbae..1fac80928 100644 --- a/src/desktop-lite/NOTES.md +++ b/src/desktop-lite/NOTES.md @@ -33,7 +33,7 @@ If you add custom content to your base image or a Dockerfile in this location, t See the [Fluxbox menu documentation](http://www.fluxbox.org/help/man-fluxbox-menu.php) for format details. More information on additional customization can be found in Fluxbox's [help](http://www.fluxbox.org/help/) and [general](http://fluxbox.sourceforge.net/docbook/en/html/book1.html) documentation. -If you prefer not to use Fluxbox, you can set the `installFluxbox` Feature option to `false` and install your own window manager. +If you prefer not to use Fluxbox, you can set the `installFluxbox` feature option to `false` and install your own window manager. ## Resolving crashes From eff89e744cc0f69d1feab083aefe0728208fa7e6 Mon Sep 17 00:00:00 2001 From: Phorcys <57866459+phorcys420@users.noreply.github.com> Date: Wed, 14 Aug 2024 12:01:40 +0200 Subject: [PATCH 6/6] chore: bump desktop-lite version to 1.2.4 --- src/desktop-lite/devcontainer-feature.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/desktop-lite/devcontainer-feature.json b/src/desktop-lite/devcontainer-feature.json index e8db26a92..7023ca09c 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.3", + "version": "1.2.4", "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.",