6

Application (Firefox default browser) opening on 2nd workspace, while starting it from 1st workspace, after it has previously been opened by a program running in Wine (World of Tanks).

Also after booting the computer, Firefox keeps opening on the 2nd workspace, while the master password popup is on the 1st workspace where I opened it.

This gets extra confusing if the focus also goes to Firefox on the 2nd workspace, and you can not press any button on it like its frozen, due too the popup master password window on the other/1st workspace effectively being hidden from view, which needs to be exited first.

I am using four fixed workspaces, not on demand workspaces, although I assume that has nothing to do with it.

I am using Ubuntu 18.04 LTS 64bit.

In principle the solution to fix it temporarily is to open Firefox in Wine/WoT while it is running on the 1st user space, this 'fixes' it for opening FF on the 1st user space for one time it seems, how ever the same issue continues when trying to open FF in testing on different work spaces, it keeps popping back to the 2nd user space.

Also the opening on the 2nd user space seems to persist, after opening FF multiple times on the 1st user space.

muru
  • 207,228

3 Answers3

1

You should check if you have "restore previous session" enabled in Firefox? If so, you may be able to fix the problem by disabling it.

Having that enabled is at least is a way to trigger this behaviour on my Xubuntu 16.04, 18.04 and 20.04 installations. However I don't think this is intended.

Eliah Kagan
  • 119,640
1

This is a feature introduced in Firefox a few years back. I remember reading about it arriving, but didn't test it at the time. Recently, it started to bug me a lot, since my DE uses dynamic workspaces and Firefox nearly always opens at the wrong one.

Anyway, I managed to find the official way to fix it:

  1. Open new tab and enter about:config as address.
  2. Search widget.disable-workspace-management and toggle it to True.

Then open Firefox Settings and flip the switch on "Restore previous session" according to your preference:

  • On = to keep tabs from last session;
  • Off = to not restore any state from last session.

The last part of toggling the switch in settings is important to apply also the previous change about workspace management. The fix didn't work without it.

I prefer to keep tabs from last session, but have Firefox open in front of me, rather than on different workspace, so I toggled the session setting Off and then back On again.

jena
  • 426
0

I solved this problem for myself by using xdotool to snap firefox into place after launch. It works by launching firefox, waiting a bit, then using xdotool to find and relocate the firefox window to the current workspace.

Currently, I only have it set to only relocate the window when first ran. If there's a firefox window already open, it will just launch a new one instead of relocating the existing window.


Create a script like this:

#!/bin/bash   
profile="$1"

ff(){ if [[ -z "$profile" ]]; then firefox & disown else firefox -P "$profile" & disown fi

}

desktop=xdotool get_desktop echo "Current Desktop = $desktop" if [[ -z "xdotool search --class firefox" ]]; then echo "FF not found, launching..." ff # Wait for firefox to load and come to focus, then move to current desktop for x in {1..8}; do sleep 1 xdotool search --class firefox || continue focus=xdotool getwindowfocus getwindowname echo "Window focus: $focus" xdotool set_desktop $desktop xdotool search --class firefox set_desktop_for_window %@ $desktop echo $focus | grep "Mozilla Firefox$" && break done # Retry command as the above one seems to fail 10% of the time sleep 1 xdotool set_desktop $desktop xdotool search --class firefox set_desktop_for_window %@ $desktop else echo "FF already exists, launching a new window" ff fi

Make it executable with chmod +x <scriptname.sh>

Then edit your desktop launchers to point to the new script.

Optionally, you can call it with scriptname.sh profilename to launch a particular profile.