Skip to content

Instantly share code, notes, and snippets.

@CodeIter
Last active June 28, 2024 16:23
Show Gist options
  • Save CodeIter/eefa149414a2990f853fbb29eae0bb44 to your computer and use it in GitHub Desktop.
Save CodeIter/eefa149414a2990f853fbb29eae0bb44 to your computer and use it in GitHub Desktop.
generates a set of shell scripts that can be used to launch various window managers in Termux's X11 environment.
for i in icewm jwm fluxbox openbox bspwm 2bwm fvwm xorg-twm awesome i3 ; do ( echo '#!/usr/bin/env -S bash -xeuo pipefail' ; echo ; echo 'export DISPLAY="${DISPLAY:-:0}"' ; echo 'export DISPLAY="${1:-${DISPLAY}}"' ; echo 'shift || true' ; echo ; echo 'if [[ "${1:-}" == "nodbus" ]] ; then' ; echo ' shift || true' ; echo ' export NO_DBUS="y"' ; echo 'fi' ; echo ; echo 'if [[ "${1:-}" == "dbus" ]] ; then' ; echo ' shift || true' ; echo ' export NO_DBUS=""' ; echo 'fi' ; echo ; echo 'if [[ -n "${NO_DBUS:-}" ]] ; then' ; echo ' export DBUS_CMD=""' ; echo 'else' ; echo ' export DBUS_CMD="${DBUS_CMD:-dbus-launch --exit-with-x11 --exit-with-session}"' ; echo ' if [[ -n "${1:-}" ]] ; then' ; echo ' export DBUS_CMD="${@}"' ; echo ' fi' ; echo 'fi' ; echo ; echo 'termux-x11 "${DISPLAY:-0}" v -p "${SCREENSAVER_MIN:-5}" -terminate "${RESET_SEC:-60}" -schedInterval "${SCHED_MS:-500}" -br -dpi "${DPI:-96}" -deferglyphs "${DIFFER_GLYPHS:-all}" -maxclients "${MAX_CLIENTS:-64}" -once -listen unix -nolisten tcp +bs +iglx +xinerama +extension MIT-SHM +extension XINERAMA +extension XFIXES +extension RENDER +extension RANDR +extension COMPOSITE +extension DAMAGE +extension MIT-SCREEN-SAVER +extension DOUBLE-BUFFER +extension RECORD +extension DPMS +extension X-Resource +extension XVideo +extension XVideo-MotionCompensation +extension GLX -tst ${TERMUX_X11_OPTS:-} -xstartup "${DBUS_CMD:-} '"$i"'"' ; echo ) | tee ~/.local/bin/termux-x11-"${i//-/}".sh ; echo ; done ; chmod u+x ~/.local/bin/*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment