34 lines
511 B
Bash
Executable File
34 lines
511 B
Bash
Executable File
#!/usr/bin/env sh
|
|
|
|
killXephyr() {
|
|
kill "$(pgrep Xephyr)" >/dev/null 2>&1
|
|
}
|
|
|
|
trap killXephyr EXIT
|
|
|
|
if [ "$1" = "stop" ]; then
|
|
killXephyr
|
|
exit 0
|
|
fi;
|
|
|
|
xephyr=$1
|
|
awesome=$2
|
|
rc_file=$3
|
|
|
|
# Check for the first free display
|
|
for i in $(seq 1 10); do
|
|
if [ ! -f "/tmp/.X${i}-lock" ]; then
|
|
D=$i;
|
|
break;
|
|
fi;
|
|
done
|
|
|
|
# Start Xephyr
|
|
$xephyr :"$D" -name xephyr_"$D" -ac -br -noreset -screen 1600x900 >/dev/null 2>&1 &
|
|
sleep 1
|
|
|
|
# Start Awesome
|
|
DISPLAY=:$D.0 $awesome \
|
|
--config "$rc_file"
|
|
|