Another copy of my dotfiles. Because I don't completely trust GitHub.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
633 B

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