--x11 shows the desktop on the X server in $DISPLAY: a resizable window under a window manager (--fullscreen asks it for fullscreen), or the whole screen when no window manager runs, following xrandr resizes. compositor/x11 is a pure X11 wire-protocol client (no libX11/xcb), so it runs in the wasm compositor on both hosts and in the native build. Frames go through MIT-SHM 1.2 (ShmAttachFd of the host frame memfd, paced by ShmCompletion), with a core PutImage fallback. The keymap given to clients is the X server's own (xkbcomp -xkb $DISPLAY -); X auto-repeat is dropped, modifier/lock state comes from X's modifier map; MIT-MAGIC-COOKIE-1 auth. chandra-session --x11 (and the new "Chandra (X11)" xsessions entry) runs it as the login session; --login-session gives an X11 session what --drm implied (power actions, polkit agent, system theme). just run-x11. Docs: docs/x11.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DPL5hhLFs4VtHV26G1iyeo
This commit is contained in:
14 files changed
+1777
-19
No files matched your search
+23
-4
@@ -1,7 +1,10 @@
|
||||
#!/bin/sh
|
||||
# Login-session entry point for Chandra (started by the display manager).
|
||||
# Runs the compositor on the seat's display via DRM/KMS + libinput and logs to
|
||||
# ~/.local/state/chandra/session.log. By default that is the compositor as a
|
||||
# ~/.local/state/chandra/session.log. With --x11 (the "Chandra (X11)" entry in
|
||||
# /usr/share/xsessions, or `exec chandra-session --x11` in ~/.xinitrc) it runs on the X server
|
||||
# in $DISPLAY instead and covers the whole screen: for GPUs whose driver gives Chandra no KMS
|
||||
# path, such as NVIDIA's proprietary one (docs/x11.md). By default that is the compositor as a
|
||||
# WebAssembly component, run by chandra-host; if only the native binary was installed
|
||||
# (session/install.py --native), it runs that instead.
|
||||
share=/usr/local/share/chandra
|
||||
@@ -28,6 +31,22 @@ if [ -z "$XDG_RUNTIME_DIR" ] && [ -d "/run/user/$(id -u)" ] && [ -O "/run/user/$
|
||||
fi
|
||||
case "$0" in /*) self="$0" ;; *) self="$PWD/$0" ;; esac # for the dbus-run-session re-exec
|
||||
|
||||
# The display backend: drm (default) or x11. Kept in the environment so the dbus-run-session
|
||||
# re-exec below (which drops the arguments) still knows.
|
||||
if [ "${1:-}" = "--x11" ]; then
|
||||
export CHANDRA_BACKEND=x11
|
||||
fi
|
||||
case "${CHANDRA_BACKEND:-drm}" in
|
||||
x11)
|
||||
backend="--x11 --login-session"
|
||||
if [ -z "${DISPLAY:-}" ]; then
|
||||
echo "chandra-session: --x11 needs DISPLAY (start it from an X session or ~/.xinitrc)" >&2
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
*) backend=--drm ;;
|
||||
esac
|
||||
|
||||
export XDG_SESSION_TYPE=wayland
|
||||
export XDG_CURRENT_DESKTOP=chandra
|
||||
export XDG_SESSION_DESKTOP=chandra
|
||||
@@ -95,7 +114,7 @@ fi
|
||||
if command -v dbus-update-activation-environment >/dev/null 2>&1; then
|
||||
dbus-update-activation-environment --systemd \
|
||||
WAYLAND_DISPLAY="$(basename "$sock")" XDG_SESSION_TYPE XDG_CURRENT_DESKTOP \
|
||||
XDG_SESSION_DESKTOP QT_QPA_PLATFORM QT_QPA_PLATFORMTHEME >>"$log" 2>&1 ||
|
||||
XDG_SESSION_DESKTOP QT_QPA_PLATFORM QT_QPA_PLATFORMTHEME ${DISPLAY:+DISPLAY} >>"$log" 2>&1 ||
|
||||
dbus-update-activation-environment \
|
||||
WAYLAND_DISPLAY="$(basename "$sock")" XDG_SESSION_TYPE XDG_CURRENT_DESKTOP \
|
||||
XDG_SESSION_DESKTOP QT_QPA_PLATFORM QT_QPA_PLATFORMTHEME >>"$log" 2>&1 || true
|
||||
@@ -122,7 +141,7 @@ fi
|
||||
# A logind session without a seat (made by run0 --user=..., su - or ssh rather than by logging in
|
||||
# on the VT) can't open the screen and input devices through logind; say so in the log, since
|
||||
# the compositor's own error ("could not take control of the session") doesn't explain why.
|
||||
if [ -n "$XDG_SESSION_ID" ] && command -v loginctl >/dev/null 2>&1; then
|
||||
if [ "$backend" = --drm ] && [ -n "$XDG_SESSION_ID" ] && command -v loginctl >/dev/null 2>&1; then
|
||||
seat=$(loginctl show-session "$XDG_SESSION_ID" -p Seat --value 2>/dev/null)
|
||||
if [ -z "$seat" ]; then
|
||||
echo "chandra-session: login session $XDG_SESSION_ID has no seat (started by run0, su or" \
|
||||
@@ -157,5 +176,5 @@ for a in \
|
||||
done
|
||||
export CHANDRA_POLKIT_FALLBACK="$fallback"
|
||||
|
||||
exec "$@" --drm --socket "$sock" \
|
||||
exec "$@" $backend --socket "$sock" \
|
||||
--theme "$share/config/themes/moon-night.json" >>"$log" 2>&1
|
||||
Reference in new issue
Block a user