Fixing kiosk mode when a new surf instance is run.
[surf.git] / surf-open.sh
1 #!/bin/sh
2 #
3 # See the LICENSE file for copyright and license details. 
4 #
5
6 xidfile="$HOME/tmp/tabbed-surf.xid"
7 uri=""
8
9 if [ "$#" -gt 0 ];
10 then
11         uri="$1"
12 fi
13
14 runtabbed() {
15         tabbed -dn tabbed-surf -r 2 surf -e '' "$uri" >"$xidfile" \
16                 2>/dev/null &
17 }
18
19 if [ ! -r "$xidfile" ];
20 then
21         runtabbed
22 else
23         xid=$(cat "$xidfile")
24         xprop -id "$xid" 2>&1 >/dev/null
25         if [ $? -gt 0 ];
26         then
27                 runtabbed
28         else
29                 surf -e "$xid" "$uri" 2>&1 >/dev/null &
30         fi
31 fi
32