blob: eaa500d08143c2cebcef36648b08941f5d3de569 [file] [log] [blame]
Dan Walsh37644bf2011-07-06 20:52:38 -04001#!/bin/bash
2trap "" TERM
Daniel J Walshd6848ea2010-06-10 16:35:55 -04003context=`id -Z | secon -t -l -P`
4export TITLE="Sandbox $context -- `grep ^#TITLE: ~/.sandboxrc | /usr/bin/cut -b8-80`"
Dan Walsh83e64162011-06-07 08:34:04 -04005[ -z $1 ] && export SCREENSIZE="1000x700" || export SCREENSIZE="$1"
6[ -z $2 ] && export DPI="96" || export DPI="$2"
Daniel J Walshd6848ea2010-06-10 16:35:55 -04007trap "exit 0" HUP
8
Dan Walsh9e0c7372013-10-09 17:26:41 -04009mkdir -p ~/.config/openbox
10cat > ~/.config/openbox/rc.xml << EOF
11<openbox_config xmlns="http://openbox.org/3.4/rc"
12 xmlns:xi="http://www.w3.org/2001/XInclude">
13<applications>
14 <application class="*">
15 <decor>no</decor>
16 <desktop>all</desktop>
17 <maximized>yes</maximized>
18 </application>
19</applications>
20</openbox_config>
21EOF
22
Dan Walsha387e152013-10-09 17:28:04 -040023(/usr/bin/Xephyr -resizeable -title "$TITLE" -terminate -screen $SCREENSIZE -dpi $DPI -nolisten tcp -displayfd 5 5>&1 2>/dev/null) | while read D; do
Daniel J Walshd6848ea2010-06-10 16:35:55 -040024 export DISPLAY=:$D
Eric Parisd7258412011-08-10 17:22:41 -040025 cat > ~/seremote << __EOF
26#!/bin/sh
27DISPLAY=$DISPLAY "\$@"
28__EOF
29 chmod +x ~/seremote
30 /usr/share/sandbox/start $HOME/.sandboxrc
Daniel J Walshd6848ea2010-06-10 16:35:55 -040031 export EXITCODE=$?
Dan Walsh37644bf2011-07-06 20:52:38 -040032 kill -TERM 0
Daniel J Walshd6848ea2010-06-10 16:35:55 -040033 break
34done
35exit 0