Moved to the blog pages

Most pages were moved to the new Linux - Programming - Technology blog.
Do not hesitate to take a look.

Firefox script to open in new window, new tab and open local files

I have created script that extends original firefox script with a few options. Running the script will handle the situation when firefox is called when another firefox is running, and pass the URL to the old one.
Moreover it adds switch, so you can select if the url passed will be opened in new window, new tab, or let firefox decide. Also it will allow passing local files (relative too), that will be correctly prefixed with file:// and path, and passed to firefox. From script help:
firefox [ -t | -n ] [ URL | PATH ] ...
  -t                    open in new tab
  -n                    open in new window
  none                  open in same or new tab/window depending on user setting s
  URL                   open URL
  PATH                  open PATH (can be relative)
  none                  open new firefox default page or blank page (tab)

If there is no firefox running, it will be started

  firefox -t            open new blank tab
  firefox -n URL        open URL in new window
  firefox -t image.jpg  open image.jpg from current directory in new tab
  firefox subdir        open subdir of current directory
  firefox .             open current directory
  firefox -n URL URL    open URL in new window and following ones in new tabs
Download: firefox-wrapper-1.1.tar.gz
You will need to hand edit the script to enter path to the original firefox. You can check it with whereis firefox or type firefox command. Usually it will be /usr/bin/firefox.
Also you should put that script on a search path so it is executed before orignial firefox, or always use full path to execute it. For example you can copy the file to /usr/local/bin, and add /usr/local/bin to the search path (if not there already, see 'echo $PATH' and /etc/profile).

→ Go back to Linux resources page

Jan SÅ‚upski, email: jslupski at juljas dot net