--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
|
||||
@@ -0,0 +1,7 @@
|
||||
[Desktop Entry]
|
||||
Name=Chandra (X11)
|
||||
Comment=Chandra desktop on the Xorg server, for GPUs without a KMS path Chandra can use (NVIDIA's proprietary driver)
|
||||
Exec=/usr/local/bin/chandra-session --x11
|
||||
TryExec=/usr/local/bin/chandra-session
|
||||
Type=Application
|
||||
DesktopNames=chandra
|
||||
@@ -30,6 +30,7 @@ Installs:
|
||||
/usr/local/share/chandra/{config,wit,assets}/ files the compositor reads at runtime
|
||||
/usr/local/share/chandra/modules/*.wasm the panel's wasm modules (build them first: just modules)
|
||||
/usr/share/wayland-sessions/chandra.desktop display-manager entry
|
||||
/usr/share/xsessions/chandra-x11.desktop display-manager entry on Xorg (NVIDIA; docs/x11.md)
|
||||
/usr/share/xdg-desktop-portal/portals/chandra.portal xdg-desktop-portal backend: the compositor
|
||||
/usr/share/xdg-desktop-portal/chandra-portals.conf serves Settings (apps' dark/light preference)
|
||||
"""
|
||||
@@ -56,6 +57,7 @@ targets = [
|
||||
"/usr/local/share/color-schemes/ChandraDark.colors",
|
||||
"/usr/local/share/color-schemes/ChandraLight.colors",
|
||||
"/usr/share/wayland-sessions/chandra.desktop",
|
||||
"/usr/share/xsessions/chandra-x11.desktop",
|
||||
"/usr/share/xdg-desktop-portal/portals/chandra.portal",
|
||||
"/usr/share/xdg-desktop-portal/chandra-portals.conf",
|
||||
]
|
||||
@@ -144,6 +146,8 @@ for f in ("ChandraDark.colors", "ChandraLight.colors"):
|
||||
put(os.path.join(root, "session/color-schemes", f), "/usr/local/share/color-schemes/" + f, 0o644)
|
||||
# The display-manager entry stays a real file: some managers don't follow symlinks there.
|
||||
put(os.path.join(root, "session/chandra.desktop"), "/usr/share/wayland-sessions/chandra.desktop", 0o644)
|
||||
# The same desktop on an X server (the display manager starts Xorg): for NVIDIA's proprietary driver.
|
||||
put(os.path.join(root, "session/chandra-x11.desktop"), "/usr/share/xsessions/chandra-x11.desktop", 0o644)
|
||||
# xdg-desktop-portal reads backends only from /usr/share (or $XDG_DESKTOP_PORTAL_DIR), not
|
||||
# /usr/local. With XDG_CURRENT_DESKTOP=chandra and no chandra-portals.conf it offered apps no
|
||||
# Settings portal at all, so Chrome, Firefox, GTK 4 and Qt 6 never saw the Dark mode switch; the
|
||||
|
||||
Reference in new issue
Block a user