-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Expand file tree
/
Copy pathstart-desktop.sh
More file actions
executable file
·97 lines (78 loc) · 2.99 KB
/
start-desktop.sh
File metadata and controls
executable file
·97 lines (78 loc) · 2.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#!/usr/bin/env bash
set -euo pipefail
if [ "$JME_DEV_ENVIRONMENT" != "yesReally" ];
then
echo "Not running! This script is meant to be run in the jMonkeyEngine dev container environment, and may do unexpected things if run elsewhere."
exit 1
fi
export DISPLAY="${DISPLAY:-:99}"
unset WAYLAND_DISPLAY WAYLAND_SOCKET XDG_RUNTIME_DIR
export GDK_BACKEND=x11
export SDL_VIDEODRIVER=x11
export GLFW_PLATFORM=x11
# Fedora noVNC web root path
NOVNC_WEB="/usr/share/novnc"
if [ ! -d "$NOVNC_WEB" ]; then
echo "ERROR: noVNC web root not found at $NOVNC_WEB"
echo "Try checking where novnc installed files are:"
rpm -ql novnc | sed -n '1,120p' || true
exit 1
fi
# Start virtual X server
if ! pgrep -f "Xvfb ${DISPLAY}" >/dev/null 2>&1; then
nohup Xvfb "${DISPLAY}" -screen 0 1440x900x24 +extension GLX +render -noreset >/tmp/xvfb.log 2>&1 &
fi
# Start a dbus session (XFCE wants it)
if ! pgrep -u "$(id -u)" -f "dbus-daemon.*--session" >/dev/null 2>&1; then
# shellcheck disable=SC2046
eval "$(dbus-launch --sh-syntax)"
fi
# Start a PolicyKit agent to avoid XFCE PolicyKitAgent errors (if available)
start_polkit_agent() {
if command -v polkit-gnome-authentication-agent-1 >/dev/null 2>&1; then
nohup polkit-gnome-authentication-agent-1 >/tmp/polkit-agent.log 2>&1 &
return
fi
if command -v xfce-polkit >/dev/null 2>&1; then
nohup xfce-polkit >/tmp/xfce-polkit.log 2>&1 &
return
fi
if [ -x "/usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1" ]; then
nohup /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 >/tmp/polkit-agent.log 2>&1 &
return
fi
echo "No PolicyKit agent found; PolicyKit dialogs may show an error."
}
start_polkit_agent
if [ "$JME_DEV_ENVIRONMENT" != "yesReally" ];
then
echo "Not running! This script is meant to be run in the jMonkeyEngine dev container environment, and may do unexpected things if run elsewhere."
exit 1
fi
# Init home
mkdir -p "$HOME/.config" "$HOME/.cache" "$HOME/.local/share"
# Start window manager
if ! pgrep -u "$(id -u)" -x xfwm4 >/dev/null 2>&1; then
nohup xfwm4 --compositor=off --daemon >/tmp/xfwm4.log 2>&1 &
fi
# Start XFCE session
if ! pgrep -u "$(id -u)" -x xfce4-session >/dev/null 2>&1; then
nohup xfce4-session >/tmp/xfce4-session.log 2>&1 &
fi
# Set wallpaper
feh --no-fehbg --bg-fill "/root/wallpaper.jpg"
# Start PulseAudio for app sound forwarding (used by Xpra speaker stream).
if command -v pulseaudio >/dev/null 2>&1; then
if ! pgrep -u "$(id -u)" -x pulseaudio >/dev/null 2>&1; then
nohup pulseaudio --start >/tmp/pulseaudio.log 2>&1 || true
fi
fi
# Start VNC server (no password; fine for Codespaces)
if ! pgrep -f "x11vnc.*-rfbport 5900" >/dev/null 2>&1; then
nohup x11vnc -display "${DISPLAY}" -nopw -forever -shared -cursor arrow -rfbport 5900 \
-nowf -noxdamage -xwarppointer -noxrecord -noxfixes >/tmp/x11vnc.log 2>&1 &
fi
# Start noVNC (websockify)
if ! pgrep -f "websockify.*6080" >/dev/null 2>&1; then
python3 -m websockify --web="${NOVNC_WEB}" 6080 localhost:5900
fi