Skip to content

Instantly share code, notes, and snippets.

@mrdomino mrdomino/chrome
Created Dec 31, 2016

Embed
What would you like to do?
OpenBSD script to run chrome as a separate user in a Xephyr window
#!/bin/sh
set -eux
NDISPLAY=:13
if [ $# -ge 1 ]
then
case $1 in
:*)
NDISPLAY=$1
shift
;;
esac
fi
Xephyr $NDISPLAY -host-cursor -no-host-grab -resizeable &
sleep 0.5
ps -p $! || exit 1
trap "kill $!" EXIT
export DISPLAY=$NDISPLAY
tmpfile=$(mktemp)
xauth -q -f $tmpfile generate $DISPLAY . trusted
xauth_data=$(xauth -f $tmpfile nlist $DISPLAY)
rm -f $tmpfile
DOAS_XAUTH="xauth -q remove $DISPLAY ; echo $xauth_data | xauth nmerge - ;"
export DOAS_XAUTH
doas -u firefox sh -c 'export HOME=/home/firefox ; cd $HOME ; eval $DOAS_XAUTH ; unset DOAS_XAUTH ; cwm & /usr/local/bin/'"$(basename $0) $@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.