From a0c352d0854d2e20c6dfa5ea9dbb019b38963e27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Hedin=20Br=C3=B8nner?= Date: Sat, 8 Sep 2018 16:36:36 +0200 Subject: [PATCH] Add `shell.sh` utility to run nested X11/wayland sessions Runs X11 by default, pass in -w to run a wayland session. The dbus address is copied to clipboard, so it's easy to connect to the new sesssion from emacs using `gnome-shell-set-dbus-address`. Depends on Xephyr in the case of x11, and xclip is used to copy the dbus address. --- shell.sh | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100755 shell.sh diff --git a/shell.sh b/shell.sh new file mode 100755 index 0000000..c08950f --- /dev/null +++ b/shell.sh @@ -0,0 +1,46 @@ +#!/usr/bin/env bash + +# Simple helper script to start nested wayland/x11 gnome sessions + +# The new dbus address is copied into the clipboard so you're able to run +# `M-x # gnome-shell-set-dbus-address` and paste the address. + +old_display=$DISPLAY + +d=0 +while [ -e /tmp/.X11-unix/X${d} ]; do + d=$((d + 1)) +done + +NEW_DISPLAY=:$d + +export XDG_CONFIG_HOME=$HOME/paperwm/.config + +args=() + +DISPLAY=$NEW_DISPLAY +eval $(dbus-launch --exit-with-session --sh-syntax) +echo $DBUS_SESSION_BUS_ADDRESS + +echo -n $DBUS_SESSION_BUS_ADDRESS \ + | DISPLAY=$old_display xclip -i -selection clipboard + +DISPLAY=$old_display +case $1 in + w*|-w*|--w*) + echo "Running Wayland Gnome Shell" + args=(--nested --wayland) + ;; + *) + echo "Running X11 Gnome Shell" + Xephyr $NEW_DISPLAY & + DISPLAY=$NEW_DISPLAY + args=--x11 + ;; +esac + + +dconf write /org/gnome/shell/enabled-extensions "['paperwm@hedning:matrix.org]" + +gnome-shell $args & +