surf_tabs 421 B

123456789101112131415161718192021222324252627282930
  1. #!/bin/sh
  2. mkdir -p "/run/user/"$(id -u)""
  3. xidfile="/run/user/"$(id -u)"/glinks-tabbed.xid"
  4. if [ "$#" -gt 0 ];
  5. then
  6. uri="$1"
  7. fi
  8. runtabbed() {
  9. tabbed -cdn Links -r 3 surf -N -e '' "$uri" >"$xidfile" \
  10. 2>/dev/null &
  11. }
  12. if [ ! -r "$xidfile" ];
  13. then
  14. runtabbed
  15. else
  16. xid=$(cat "$xidfile")
  17. xprop -id "$xid" >/dev/null 2>&1
  18. if [ $? -gt 0 ];
  19. then
  20. runtabbed
  21. else
  22. surf -N -e "$xid" "$uri" >/dev/null 2>&1 &
  23. fi
  24. fi