Files
2026-08-26 23:16:01 +12:00

63 lines
2.0 KiB
Bash

#!/bin/sh
# Recommended VMware development session entry point.
#
# Sets compositor-side development environment (cursor theme, software
# cursors if needed) and starts Sway with the Nebula development config.
# Sway then autostarts nebula-shell via scripts/run-nebula-vm.sh.
#
# Usage:
# ./compositor/sway/dev/run-sway-vm.sh
#
# Equivalent:
# export XCURSOR_THEME=Adwaita XCURSOR_SIZE=24
# sway -c compositor/sway/nebula-sway.conf
#
# Skip shell autostart:
# NEBULA_SHELL_AUTOSTART=0 ./compositor/sway/dev/run-sway-vm.sh
set -eu
script_dir=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
repo_root=$(CDPATH= cd -- "${script_dir}/../../.." && pwd)
config="${repo_root}/compositor/sway/nebula-sway.conf"
if command -v realpath >/dev/null 2>&1; then
repo_root=$(realpath "${repo_root}")
config=$(realpath "${config}")
fi
export XDG_CURRENT_DESKTOP="${XDG_CURRENT_DESKTOP:-NebulaOS}"
export XDG_SESSION_DESKTOP="${XDG_SESSION_DESKTOP:-nebula}"
export XCURSOR_THEME="${XCURSOR_THEME:-Adwaita}"
export XCURSOR_SIZE="${XCURSOR_SIZE:-24}"
# VMware often needs software cursors. This is development-specific.
export WLR_NO_HARDWARE_CURSORS="${WLR_NO_HARDWARE_CURSORS:-1}"
if [ ! -f "${config}" ]; then
echo "nebula: missing Sway config at ${config}" >&2
exit 1
fi
if grep -q '^[[:space:]]*title_format\>' "${config}"; then
echo "nebula: refusing to start; ${config} still contains title_format" >&2
echo "nebula: this Sway build does not support that command." >&2
exit 1
fi
echo "nebula: repo ${repo_root}"
echo "nebula: config ${config}"
echo "nebula: sway $(command -v sway 2>/dev/null || echo missing)"
if [ -n "${SWAYSOCK:-}" ]; then
echo "nebula: SWAYSOCK is set to ${SWAYSOCK}" >&2
echo "nebula: you are already inside a compositor session." >&2
echo "nebula: log out of that session or switch to a TTY (Ctrl+Alt+F3)," >&2
echo "nebula: then start Sway from ~/Nebula-OS so this config is used." >&2
exit 1
fi
cd "${repo_root}"
echo "nebula: starting Sway with ${config}"
exec sway -c "${config}" "$@"