firefox-socket 345 B

123456789101112131415161718192021
  1. #!/bin/sh
  2. BROWSERPATH="LibreWolf"
  3. _sock="/tmp/firefox.sock"
  4. if [ -S "${_sock}" ]
  5. then
  6. if [ ${#} -eq 0 ]
  7. then
  8. printf 'nw' | nc -NU "${_sock}"
  9. else
  10. printf '%s' "nw$(printf '|%s' "${@}")" | nc -NU "${_sock}"
  11. fi
  12. else
  13. if ! pgrep -f '$BROWSERPATH' > /dev/null
  14. then
  15. exec $BROWSERPATH "${@}"
  16. fi
  17. fi