glinks 793 B

12345678910111213141516171819202122232425262728293031323334
  1. #!/bin/sh
  2. mkdir -p "/run/user/"$(id -u)""
  3. xidfile="/run/user/"$(id -u)"/glinks-tabbed.xid"
  4. useragent="Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:74.0) Gecko/20100101 Firefox/74.0"
  5. if [ ! $(pgrep -x miniwebproxy) ]; then
  6. cd ~/git/miniwebproxy/
  7. ./miniwebproxy &
  8. echo 'turning on web proxy'
  9. fi
  10. [ "$#" -gt 0 ] && uri="$1"
  11. runtabbed() {
  12. echo spawning
  13. tabbed -cdn "Links" -r 3 links -g -w '' \
  14. -https-proxy localhost:8090 -http-proxy localhost:8090 -http.fake-user-agent "$useragent" "$uri" > $xidfile 2>/dev/null &
  15. }
  16. if [ ! -r "$xidfile" ];
  17. then
  18. runtabbed
  19. else
  20. xid=$(cat "$xidfile")
  21. xprop -id "$xid" >/dev/null 2>&1
  22. if [ $? -gt 0 ];
  23. then
  24. runtabbed
  25. else
  26. links -g -w "$xid" -https-proxy localhost:8090 -http-proxy localhost:8090 -http.fake-user-agent "$useragent" "$uri" &
  27. fi
  28. fi