-
Notifications
You must be signed in to change notification settings - Fork 29
Expand file tree
/
Copy pathlaunch
More file actions
executable file
·74 lines (72 loc) · 3.01 KB
/
launch
File metadata and controls
executable file
·74 lines (72 loc) · 3.01 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
#sleep 5; VOXEL_API_BIND=tcp://*:3345 ./matrix
#sleep 5; WLR_BACKENDS=x11 VOXEL_API_BIND=tcp://*:3345 ./matrix-wlroots
BASE_DIR="$(cd "$(dirname "$0")" && pwd)"
export XDG_RUNTIME_DIR="${XDG_RUNTIME_DIR:-/tmp/xdg-runtime-$USER}"
mkdir -p "$XDG_RUNTIME_DIR"
chmod 700 "$XDG_RUNTIME_DIR"
export LD_LIBRARY_PATH="$BASE_DIR/wlroots/build:$BASE_DIR/wlroots/build/subprojects/wayland/src:${LD_LIBRARY_PATH}"
# Force a known-good cursor theme/size so wlroots loads a real arrow instead of a garbled fallback.
export XCURSOR_THEME="${XCURSOR_THEME:-Adwaita}"
export XCURSOR_SIZE="${XCURSOR_SIZE:-24}"
export XCURSOR_PATH="${XCURSOR_PATH:-/usr/share/icons}"
# Prefer discrete GPU for all launched apps (Wayland clients inherit this).
#export DRI_PRIME="${DRI_PRIME:-1}"
# Force NVIDIA offload/proprietary stack; clients inherit these.
#export __NV_PRIME_RENDER_OFFLOAD="${__NV_PRIME_RENDER_OFFLOAD:-1}"
#export __GLX_VENDOR_LIBRARY_NAME="${__GLX_VENDOR_LIBRARY_NAME:-nvidia}"
#export __VK_LAYER_NV_optimus="${__VK_LAYER_NV_optimus:-NVIDIA_only}"
#export GBM_BACKEND="${GBM_BACKEND:-nvidia-drm}"
# Hint to kernel/driver; requires nvidia-drm modeset enabled at boot.
#export __NV_DRM_Modeset="${__NV_DRM_Modeset:-1}"
# Force software cursors; some GPUs/DRM combos show corrupted hardware cursors.
export WLR_NO_HARDWARE_CURSORS=1
# Enable Wayland app sampling logs so buffer import/fallback is visible.
export MATRIX_WAYLANDAPP_SAMPLE_LOGS="${MATRIX_WAYLANDAPP_SAMPLE_LOGS:-1}"
# Optional flags (handled by the compositor binary):
# --in-wm -> delay start when running inside another WM.
# --headless -> force wlroots headless backend (for TTY/headless use).
# --drm -> force wlroots DRM backend (run as a real compositor on TTY).
BACKEND=""
while [ $# -gt 0 ]; do
case "$1" in
--headless)
BACKEND="headless"
shift
;;
--drm)
BACKEND="drm"
shift
;;
*)
break
;;
esac
done
# If no backend was requested explicitly, prefer Wayland when already running
# inside another compositor so nested instances work out of the box.
if [ -z "$BACKEND" ] && [ -z "${WLR_BACKENDS:-}" ] && [ -n "${WAYLAND_DISPLAY:-}" ]; then
BACKEND="wayland"
fi
if [ -n "$BACKEND" ]; then
export WLR_BACKENDS="$BACKEND"
if [ "$BACKEND" = "drm" ]; then
# Prefer logind for seat access when running on a TTY.
export LIBSEAT_BACKEND="${LIBSEAT_BACKEND:-logind}"
# Pick a predictable primary DRM device when none was provided so hybrid GPU
# setups don't accidentally render on a headless card.
if [ -z "${WLR_DRM_DEVICES:-}" ] && [ -e /dev/dri/card0 ]; then
export WLR_DRM_DEVICES="/dev/dri/card0"
fi
# Ensure XDG_RUNTIME_DIR exists; logind normally sets this.
if [ -z "${XDG_RUNTIME_DIR:-}" ]; then
export XDG_RUNTIME_DIR="/run/user/$(id -u)"
mkdir -p "$XDG_RUNTIME_DIR"
chmod 700 "$XDG_RUNTIME_DIR"
fi
fi
fi
BIN="${MATRIX_WLROOTS_BIN:-./build/matrix}"
export ENABLE_RENDER_TMP_LOGS=1
export WLR_APP_SAMPLE_LOG=1
export VOXEL_API_BIND="${VOXEL_API_BIND:-tcp://*:3345}"
"${BIN}" "$@"