0

I am running Ubuntu 10.04 LTS. I have 4 Gnome-style workspaces -- only one of the 4 workspaces is visible on-screen at a time.

As a programmer, I periodically need to launch an embedded browser from a bash script.

The main feature I need is that the browser must open in the same workspace as the bash script it is called from, even if another instance of the browser is running in another (inactive) workspace.

CASE 1: No instance is running

  1. Running the Opera browser from the script with the URL as the sole parameter displays the Speed-Dial tab, and a second tab with my content. UNDESIRED BEHAVIOUR
  2. Even worse, if I add the -newwindow in the above case, two windows get spawned, one with the Speed-Dial tab, and a second with with my content. UNDESIRED BEHAVIOUR
  3. Running the Opera browser from the script with the URL as a parameter along with -activetab displays my content as the sole tab of the browser in my current workspace. THIS IS THE BEHAVIOUR I WANT!
  4. If I specify both -newwindow and -activetab, in the above case, it appears that -activetab is ignored. REFERENCE BEHAVIOUR

CASE 2: Another instance is running

  1. Running the Opera browser from the script without the URL as the sole parameter outputs "Activated running instance" and the webpage opens in that browser. UNDESIRED BEHAVIOUR
  2. Running the Opera browser with the -newwindow option launches a new window in my current workspace with my content as the sole tab of the browser. THIS IS THE BEHAVIOUR I WANT.
  3. Running the Opera browser from the script with the URL as a parameter along with -activetab displays replaces the content in that workspace and displays only "Activated Running Instance" in the script window. UNDESIRED BEHAVIOUR
  4. If I specify both -newwindow and -activetab, in the above case, it appears that -newwindow is ignored. INCONSISTENT BEHAVIOUR
vo1stv
  • 55
  • 2
  • 17
  • ------------------- Appendix What's an embedded browser? I've chosen Opera. (Before suggesting another, please read my definition below.) For the purpose above an embedded browser is a browser I can install and remove as necessary without worrying that it will interfere the user's (making me the programmer) setup and preferences. Once installed I can be guaranteed it will function according to my expectations. Opera's small size and its support for alternate package names on installation makes it ideal. – vo1stv May 14 '12 at 20:44
  • The following link provides a workaroud: http://stackoverflow.com/q/2000050/201008. As a minimum I can call `wmctrl -R Speed Dial - Opera` which, opposite to the documentation, swiches the desktop to wherever the current instance of opera is. – vo1stv May 15 '12 at 11:47
  • Another option (provided offline to me) is to use `ps` to search for the alternate Opera package name specified (during installation) in the list of running processes. If a process is running, omit the -newwindow and use -activetab instead – vo1stv May 15 '12 at 17:15

1 Answers1

0

The solution I've accepted is:

  1. Always provide the URL and -newwindow as the only parameters.
  2. After launching the window, use wmctrl to get rid of the unwanted "Speed Dial" browser window (if it was created) by issuing:
        wmctrl -c "Speed Dial - Opera"
vo1stv
  • 55
  • 2
  • 17
  • Here's a different but related question posted to AskUbuntu: http://askubuntu.com/questions/18502/how-to-solve-this-problem-starting-new-opera-windows-on-dual-monitor-setup – vo1stv May 18 '12 at 12:41