mirror of
https://github.com/lbonn/rofi
synced 2024-11-27 06:10:30 +00:00
41 lines
548 B
Bash
Executable file
41 lines
548 B
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
XPID=
|
|
FPID=
|
|
function create_fake_x ( )
|
|
{
|
|
export DISPLAY=":$1"
|
|
echo "Starting fake X: ${DISPLAY}"
|
|
Xvfb ${DISPLAY} &
|
|
XPID=$!
|
|
sleep 1;
|
|
fluxbox &
|
|
FPID=$!
|
|
sleep 1
|
|
}
|
|
|
|
function destroy_fake_x ( )
|
|
{
|
|
if [ -n "${XPID}" ]
|
|
then
|
|
echo "Stopping fake X: ${XPID} - ${FPID}"
|
|
kill ${FPID}
|
|
wait ${FPID}
|
|
kill ${XPID}
|
|
wait ${XPID}
|
|
fi
|
|
}
|
|
|
|
if [ -n "$3" ]
|
|
then
|
|
export PATH=$3:$PATH
|
|
fi
|
|
|
|
create_fake_x "$1"
|
|
echo "$DISPLAY"
|
|
$2 $4
|
|
RES=$?
|
|
|
|
destroy_fake_x
|
|
|
|
exit ${RES}
|