#!/usr/bin/env bash # Run att_wm inside a nested river, as a window in your existing session. # # Nothing is installed and no system rebuild is needed — river's wayland # backend opens a normal window, and att_wm manages what is inside it. # # ./run-nested.sh # just att_wm # ./run-nested.sh --bar # also start the bundled quickshell bar # ./run-nested.sh --term # also open a terminal to look at # # Anything else you pass is run inside the session, e.g. # ./run-nested.sh --bar --term set -euo pipefail cd "$(dirname "$0")" if [[ -z ${WAYLAND_DISPLAY:-} ]]; then echo "error: no WAYLAND_DISPLAY — this needs an existing Wayland session." >&2 echo " On a TTY, use the headless backend instead:" >&2 echo " WLR_BACKENDS=headless WLR_HEADLESS_OUTPUTS=1 ./run-nested.sh" >&2 exit 1 fi want_bar=0 want_term=0 for arg in "$@"; do case $arg in --bar) want_bar=1 ;; --term) want_term=1 ;; *) echo "unknown option: $arg" >&2 exit 1 ;; esac done bin=zig-out/bin if [[ ! -x ${bin}/att_wm ]]; then echo "==> building" ./dev.sh bash -c 'zig build' fi bin=$(realpath "${bin}") init=$(mktemp) trap 'rm -f "${init}"' EXIT { echo '#!/bin/sh' # river exports the nested display to its children; surface it so you can # point att_wmctl at this instance from another terminal. echo 'echo "" >&2' echo 'echo " nested session is on WAYLAND_DISPLAY=$WAYLAND_DISPLAY" >&2' echo 'echo " drive it with: WAYLAND_DISPLAY=$WAYLAND_DISPLAY '"${bin}"'/att_wmctl state" >&2' echo 'echo "" >&2' [[ ${want_bar} -eq 1 ]] && echo "quickshell -p $(realpath quickshell) &" [[ ${want_term} -eq 1 ]] && echo 'foot &' echo "exec ${bin}/att_wm" } >"${init}" chmod +x "${init}" echo "==> starting nested river (close the window to exit)" exec env WLR_BACKENDS=wayland river -no-xwayland -c "${init}"