mirror of
https://github.com/lbonn/rofi
synced 2024-11-16 17:08:00 +00:00
36 lines
431 B
Bash
36 lines
431 B
Bash
|
#!/usr/bin/env bash
|
||
|
|
||
|
XPID=
|
||
|
DISPLAY=":0"
|
||
|
function create_fake_x ( )
|
||
|
{
|
||
|
DISPLAY=":$1"
|
||
|
echo "Starting fake X: ${DISPLAY}"
|
||
|
Xvfb ${DISPLAY} &
|
||
|
XPID=$!
|
||
|
sleep 1
|
||
|
}
|
||
|
|
||
|
function destroy_fake_x ( )
|
||
|
{
|
||
|
if [ -n "${XPID}" ]
|
||
|
then
|
||
|
echo "Stopping fake X: ${XPID}"
|
||
|
kill ${XPID}
|
||
|
wait ${XPID}
|
||
|
fi
|
||
|
}
|
||
|
|
||
|
if [ -n "$3" ]
|
||
|
then
|
||
|
PATH=$3:$PATH
|
||
|
fi
|
||
|
|
||
|
create_fake_x "$1"
|
||
|
$2
|
||
|
RES=$?
|
||
|
|
||
|
destroy_fake_x
|
||
|
|
||
|
exit ${RES}
|