forked from AddonScriptorDE/plugin.program.chrome.launcher
-
Notifications
You must be signed in to change notification settings - Fork 1
/
browser.sh
executable file
·36 lines (27 loc) · 897 Bytes
/
browser.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/bash
# Prevent loading two or more tabs due to LIRC still being enabled in XBMC / KODI
CHROME_STARTED=`ps -ef | grep google | grep chrome | grep -v "grep" | wc -l`
if [ $CHROME_STARTED -gt 0 ]; then
exit 1;
fi
# lets find out if irxevent actually exist before we try to call them.
command -v irxevent >/dev/null 2>&1
IRXEVENT=$?
if [ $IRXEVENT -eq 0 ]; then
killall irxevent >/dev/null 2>&1
fi
# http://stackoverflow.com/questions/59895/can-a-bash-script-tell-what-directory-its-stored-in
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
if [ $IRXEVENT -eq 0 ]; then
irxevent -d $DIR/netflix.lirc &
else
echo "irxevent is not installed, can't do remote control"
fi
/usr/bin/google-chrome "$@" &
CHROME_PID=$!
# wait for google-chrome to be killed before killing irxevent below.
wait $CHROME_PID
if [ $IRXEVENT -eq 0 ]; then
killall irxevent >/dev/null 2>&1
fi
exit 0