1

I already checked out a similar question, but it's obsolete and didn't quite help me, hence I'm creating a new one.

I tried passing arguments to start-tor-browser, firefox and even torbrowser-launcher scripts as well as firefox.real executable found inside the main Tor Browser directory, yet none of it worked. Instead, it kept giving me an error, stating that Tor Browser instance is already running and I should close the existing Tor Browser process in order to open a desired link. I also tried creating a shell script named test.sh that would point to one of the aforementioned scripts and executables:

#!/usr/bin/sh
$HOME/.local/share/torbrowser/tbb/x86_64/tor-browser_en-US/Browser/firefox.real "$@" &

then assigned the path to said script in newsboat config file:

browser "~/.scripts/test.sh %u"

and upon pressing 'o' button in newsboat it obviously kept giving me the same error about running instance of TBB. What should I do to resolve this? Thanks in advance.

Aaron8852
  • 13
  • 3

1 Answers1

0

I had the same problem with QuiteRSS. If I set the application's default browser to point to start-tor-browser then it can correctly launch Tor browser and open the link. However, if an instance of Tor browser is already running and I try to click a link then I get the same error as you. I am not aware of any built-in way to fix this.

Assuming you are on Linux, one workaround would be to use something like xdotool and wmctrl. You could write a simple script that gets the URL from the RSS reader as an argument and then uses wmctrl to check if an instance of Tor browser is already running. If it is, then use wmctrl and xdotool to simulate keyboard shortcuts to focus the browser window, open a new tab (Ctrl+t), activate the URL bar (Ctrl+L), paste the URL, and click enter. This would effectively achieve what you want. Something like this:

#! /bin/bash

url=$1

First, check if a window with the name 'Tor Browser' exists

(we assume there is only one instance running, which is okay

since it will not allow more than one instance anyway)

wmctrl -lp | grep 'Tor Browser' > /dev/null 2>&1

Now check exit status of the previous command

case $? in

  1. instance not found... launch it

    /your/path/to/tor-browser_en-US/Browser/start-tor-browser $url exit # quit the script ;;

  2. instance was found

    id=wmctrl -lp | grep 'Tor Browser'| awk '{print $1}' # get process ID wmctrl -iR $id # raise the process corresponding to Tor Browser xdotool key --clearmodifiers ctrl+t # open a new tab in Tor Browser xdotool type $url # type the URL in the search bar xdotool key --clearmodifiers Return # press enter exit # quit the script ;;

esac

Superbee
  • 181
  • 1
  • 6