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.

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
     ;;

  0) # 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
| improve this answer | |
  • 1
    Sorry for the late reply, completely forgot about my question. I've already written a five-line ugly script the next day I made the post here, but yours looks more thorough and appealing to me. Thanks for answering the question, by the way! – Aaron8852 Aug 3 at 21:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.