mirror of
https://github.com/davatorium/rofi.git
synced 2024-11-11 13:50:48 -05:00
35 lines
448 B
Bash
Executable file
35 lines
448 B
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
XPID=
|
|
function create_fake_x ( )
|
|
{
|
|
export 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
|
|
export PATH=$3:$PATH
|
|
fi
|
|
|
|
create_fake_x "$1"
|
|
echo "$DISPLAY"
|
|
$2
|
|
RES=$?
|
|
|
|
destroy_fake_x
|
|
|
|
exit ${RES}
|