surf-open.sh 444 B

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