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

feat(desktop-lite): make fluxbox optional #1058

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/desktop-lite/NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 prefer not to use Fluxbox, you can set the `installFluxbox` feature option 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`:
Expand Down
7 changes: 6 additions & 1 deletion src/desktop-lite/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -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.",
Expand Down Expand Up @@ -47,6 +47,11 @@
],
"default": "5901",
"description": "Enter a port for the desktop VNC server (TigerVNC)"
phorcys420 marked this conversation as resolved.
Show resolved Hide resolved
},
"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,
Expand Down
25 changes: 17 additions & 8 deletions src/desktop-lite/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,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 \
Expand Down Expand Up @@ -88,6 +88,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'
Expand Down Expand Up @@ -197,7 +198,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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# If we want to install Fluxbox, then add it to the list of pacakges
# If we want to install Fluxbox, then add it to the list of packages

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.
Expand Down Expand Up @@ -377,7 +383,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"
samruddhikhandale marked this conversation as resolved.
Show resolved Hide resolved
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"
Expand All @@ -404,11 +410,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
Expand Down
19 changes: 19 additions & 0 deletions test/desktop-lite/scenarios.json
Original file line number Diff line number Diff line change
@@ -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
}
}
}
}
1 change: 0 additions & 1 deletion test/desktop-lite/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
samruddhikhandale marked this conversation as resolved.
Show resolved Hide resolved

. /etc/os-release
if [ "${ID}" = "ubuntu" ]; then
Expand Down
8 changes: 8 additions & 0 deletions test/desktop-lite/with_fluxbox.sh
Original file line number Diff line number Diff line change
@@ -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"
8 changes: 8 additions & 0 deletions test/desktop-lite/without_fluxbox.sh
Original file line number Diff line number Diff line change
@@ -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"
Loading