awesomerc/start-xephyr.sh

34 lines
511 B
Bash
Raw Normal View History

2021-10-04 20:32:34 +02:00
#!/usr/bin/env sh
2021-11-29 18:56:22 +01:00
killXephyr() {
kill "$(pgrep Xephyr)" >/dev/null 2>&1
}
trap killXephyr EXIT
if [ "$1" = "stop" ]; then
killXephyr
exit 0
fi;
2021-10-04 20:32:34 +02:00
xephyr=$1
awesome=$2
rc_file=$3
2021-11-29 18:56:22 +01:00
# Check for the first free display
for i in $(seq 1 10); do
if [ ! -f "/tmp/.X${i}-lock" ]; then
2021-10-04 20:32:34 +02:00
D=$i;
break;
fi;
done
# Start Xephyr
2021-11-29 18:56:22 +01:00
$xephyr :"$D" -name xephyr_"$D" -ac -br -noreset -screen 1600x900 >/dev/null 2>&1 &
2021-10-04 20:32:34 +02:00
sleep 1
# Start Awesome
DISPLAY=:$D.0 $awesome \
2021-11-29 18:56:22 +01:00
--config "$rc_file"