Files
2026-08-26 22:55:24 +12:00

68 lines
2.0 KiB
Bash

#!/bin/sh
# VMware / development-only launcher for nebula-shell.
#
# The Ubuntu VMware guest GPU cannot currently run the Qt Quick accelerated
# scene graph correctly. This wrapper sets QT_QUICK_BACKEND=software.
#
# Production sessions must start `nebula-shell` directly and must NOT export
# QT_QUICK_BACKEND. GPU-accelerated Qt Quick is the production default.
#
# Usage (from a running Nebula Sway session, or via nebula-sway.conf exec):
# scripts/run-nebula-vm.sh
#
# Disable autostart:
# NEBULA_SHELL_AUTOSTART=0 sway -c compositor/sway/nebula-sway.conf
set -eu
if [ "${NEBULA_SHELL_AUTOSTART:-1}" = "0" ]; then
echo "nebula: shell autostart disabled (NEBULA_SHELL_AUTOSTART=0)"
exit 0
fi
script_dir=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
repo_root=$(CDPATH= cd -- "${script_dir}/.." && pwd)
export XCURSOR_THEME="${XCURSOR_THEME:-Adwaita}"
export XCURSOR_SIZE="${XCURSOR_SIZE:-24}"
# Development-only. Do not copy this into production session files.
export QT_QUICK_BACKEND="${QT_QUICK_BACKEND:-software}"
resolve_shell() {
if [ -n "${NEBULA_SHELL:-}" ] && [ -x "${NEBULA_SHELL}" ]; then
printf '%s\n' "${NEBULA_SHELL}"
return 0
fi
for candidate in \
"${repo_root}/shells/desktop/shell/build/nebula-shell" \
"${repo_root}/build/nebula-shell" \
"${PWD}/shells/desktop/shell/build/nebula-shell" \
"${PWD}/build/nebula-shell"
do
if [ -x "${candidate}" ]; then
printf '%s\n' "${candidate}"
return 0
fi
done
if command -v nebula-shell >/dev/null 2>&1; then
command -v nebula-shell
return 0
fi
return 1
}
if ! shell_bin=$(resolve_shell); then
echo "nebula: nebula-shell not found." >&2
echo "Build it with:" >&2
echo " cd shells/desktop/shell && cmake -S . -B build && cmake --build build -j\$(nproc)" >&2
echo "Or set NEBULA_SHELL to the executable path." >&2
exit 1
fi
echo "nebula: starting ${shell_bin} (QT_QUICK_BACKEND=${QT_QUICK_BACKEND})"
exec "${shell_bin}" "$@"