3

I'd like improve a script of mine that uses firefox to perform tasks. I need activate a window and a tab with a specific name. For example, the window name could be Mozilla Firefox and the tab http://localhost/site.php.

I can activate windows using wmctrl -a, but this doesn't work very well because all firefox windows could have Mozilla Firefox on its name, even the windows without tabs named http://localhost/site.php.

An example of what I need is: activate the tab http://localhost/site.php at the window Mozilla Firefox. I use linux and I would like a solution for this kind of system. Probably I will use shellscript (and OS commands) and python to improve the script, so solutions with them are welcome to me.

4
  • Are you aware of all the command line arguments Firefox comes with? firefox --help?
    – jippie
    May 11, 2012 at 21:15
  • 2
    Tabs are managed internally by Firefox, they are not an OS-level like windows. wmctrl can't see tabs, you need to go through Firefox. May 11, 2012 at 23:33
  • @jippie, I have read the man of firefox. No solution.
    – GarouDan
    May 12, 2012 at 1:30
  • @Gilles, maybe not, but maybe we have a solution. If I need to go to firefox to do this, how can I do this using a shellscript that calls a javascript inside firefox?
    – GarouDan
    May 12, 2012 at 1:33

1 Answer 1

-1

/path/to/firefoxbinary -new-tab http://www.google.com

is what you want. There are other useful command line arguments available:

/path/to/firefoxbinary --help

2
  • I was thinking about the -no-remote flag, which opens an entirely new firefox instance.
    – jippie
    May 12, 2012 at 10:02
  • This will work to me if I close the previous window and create another one (using no-remote). But it isn't a good solution, the script will lose in performance and I don't know how to get the pid of the new firefox instance created.
    – GarouDan
    May 12, 2012 at 13:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .