4

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
  • 197,895
  • 55
  • 485
  • 740
  • Same thing happens to me. As confirmed by @ungutknut answer, this is Firefox specific. Firefox 78 remembers workspace at the time of closing, as part of "restore previous session" feature. I will propose to them to either remove restoring to same workspace, or add Linux specific config dialog checkbox. I totally need my tabs from previous sessions, but having to find the firefox window and moving to wanted workspace and having to remember to close it in correct workspace is... like not the ideal. I'm sure somebody already notified them, but I will check just in case. – Hatoru Hansou Jul 09 '20 at 22:07
  • In the meanwhile, I propose this solution: https://askubuntu.com/questions/89946/open-application-in-specific-workspace – Hatoru Hansou Jul 09 '20 at 22:09

2 Answers2

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
  • 117,780
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.