Closed Bug 1628749 Opened 2 years ago Closed 1 year ago

Disable workspaceID fetching and moving of window on i3 and BSPWM Window Managers.

Categories

(Firefox :: Session Restore, enhancement, P5)

75 Branch
All
Linux
enhancement

Tracking

()

RESOLVED FIXED
Firefox 79
Tracking Status
firefox79 --- fixed

People

(Reporter: wekerbugs, Assigned: wekerbugs)

References

(Regression)

Details

Attachments

(1 file, 1 obsolete file)

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:75.0) Gecko/20100101 Firefox/75.0

Steps to reproduce:

Started firefox on archlinux with the WM bspwm with a rule such that every window should be opened on virtual desktop 1.
i.e. bspc rule -a firefox desktop=1

Actual results:

Windows where created (or rather where moved by firefox) on different virtual desktops but "normally started" windows where placed only on the selected virtual desktop.

Expected results:

Windows should be created only on the selected virtual desktop or rather windows should not be moved by the application after creation.

Bugbug thinks this bug should belong to this component, but please revert this change in case of error.

Component: Untriaged → Inspector: Rules
Product: Firefox → DevTools
Component: Inspector: Rules → Session Restore
Product: DevTools → Firefox
OS: Unspecified → Linux
Regressed by: 372650
Hardware: Unspecified → All

Firefox should only be moving windows to a different desktop when they're being restored - by using the menu 'Recently Closed Windows' or 'Restore Previous Session' option, not opening (a link in) a pristine window. Are you saying that happens at all? Since you filed this in the Session Restore component, I suspect not, but please let me know!
I'm afraid that if this needs explicit support in Firefox for bspwm, we're going to be dependent on contributors.

Flags: needinfo?(wekerbugs)

This is the problem. Firefox moves them after creating (or even mapping) the window, therefore overruling the WMs rules.
If I open a link in a pristine window Firefox does not move the window but the rules of my WM apply.

Flags: needinfo?(wekerbugs)

So it's basically working as designed, for now. As in, you could also consider this a feature instead of a bug; we try to make sure Firefox restores itself to the exact same state as it was before.
If someone would like to contribute support for adhering to custom WM rules, that's be awesome, but it's not something able to do right now.

Status: UNCONFIRMED → NEW
Type: defect → enhancement
Ever confirmed: true
Priority: -- → P5

When I start my firefox (75.0 as of now), it moves itself/starts/whatever on workspace 1 (i am using i3 as WM), insted of on workspace 4, which is where i assign it to, and now need to move it to manually. So in my case, the restore position does not work at all, and since it does that after mapping it seems, it is now never starting in the right place.

Summary: Windows created by session restore do not follow WM rules → Disable workspaceID fetching and moving of window on i3 and BSPWM Window Managers.

To get the name of the current WM: The atom _NET_SUPPORTING_WM_CHECK points to a window, which has the atom _NET_WM_NAME which is an UTF8 String with the current WM name.

Mine is: bspwm

This can be looked up with xprop:
xprop -root _NET_SUPPORTING_WM_CHECK
copy the hexadecimal on the right.
xprop -id $(the hex copied) _NET_WM_NAME

I hope this is helpful.

Fixing of bug 372650 also broke the desired behavior under Gnome 3 where desktops are created on the fly (when switching to the last virtual desktop, an additional virtual desktop is created) and new windows should open on the desktop the user is currently on (in case of multi-monitor setups they should open where the mouse cursor is) and should not remember where they were opened last time. So an exception for Mutter (Gnome3's window manager) should also be added in addition to i3 and BSPWM

BTW: The _NET_WM_NAME that xprop returns for the Gnome 3's shell - Mutter is GNOME Shell.

(In reply to ivailogeimara from comment #7)

Fixing of bug 372650 also broke the desired behavior under Gnome 3 where desktops are created on the fly (when switching to the last virtual desktop, an additional virtual desktop is created) and new windows should open on the desktop the user is currently on (in case of multi-monitor setups they should open where the mouse cursor is) and should not remember where they were opened last time. So an exception for Mutter (Gnome3's window manager) should also be added in addition to i3 and BSPWM

This unfortunatly looks like the intended behavior see comments in BUG 1630085. A workaround could be BUG 1628742 so one can manually disable this behavior everywhere.

I tried my hand on implementing this. I've never contributed to Firefox. I hope that I did everything right.

I did not test this on i3 but it should work.

Depends on D78129

Attachment #9153952 - Attachment is obsolete: true

(In reply to Mike de Boer [:mikedeboer] from comment #2)

Firefox should only be moving windows to a different desktop when they're being restored - by using the menu 'Recently Closed Windows' or 'Restore Previous Session' option, not opening (a link in) a pristine window. Are you saying that happens at all? Since you filed this in the Session Restore component, I suspect not, but please let me know!
I'm afraid that if this needs explicit support in Firefox for bspwm, we're going to be dependent on contributors.

Could you or someone you know review my revision. I am sorry, I don't know what the usual procedure is.

Flags: needinfo?(mdeboer)
Assignee: nobody → wekerbugs
Status: NEW → ASSIGNED

I see that Martin is taking a look, since he also kindly reviewed my patches. Thanks for taking this on, wekerbugs, I'm sure many will greatly appreciate it!

Flags: needinfo?(mdeboer)
Blocks: 1628742
Pushed by btara@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/70c8e33b5710
Disable workspaceID fetching and moving of window on i3 and BSPWM Window Managers. r=stransky
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 79
Regressions: 1645776

(In reply to Pulsebot from comment #15)

Disable workspaceID fetching and moving of window on i3 and BSPWM Window

I haven't tried firefox 79 (beta) yet, but what about Fedora MATE, with _NET_WM_NAME "Metacity (Marco)"?
I use several workspaces, and start firefox with an icon in the top panel. I want firefox to appear in whatever
workspace I click the icon from.

(In reply to Bruce Jerrick from comment #17)

I haven't tried firefox 79 (beta) yet, but what about Fedora MATE, with _NET_WM_NAME "Metacity (Marco)"?

Just tried linux-x86_64/firefox-79.0b9-beta.tar.bz2, and the move-o-matic bug is still there.
Did the i3/BSPWM fix get undone because of the 1645776 regression?

(In reply to Bruce Jerrick from comment #18)

(In reply to Bruce Jerrick from comment #17)

I haven't tried firefox 79 (beta) yet, but what about Fedora MATE, with _NET_WM_NAME "Metacity (Marco)"?

Just tried linux-x86_64/firefox-79.0b9-beta.tar.bz2, and the move-o-matic bug is still there.
Did the i3/BSPWM fix get undone because of the 1645776 regression?

With which WM where you testing?

Flags: needinfo?(bmj001)

(In reply to wekerbugs from comment #19)

I haven't tried firefox 79 (beta) yet, but what about Fedora MATE, with _NET_WM_NAME "Metacity (Marco)"?

Just tried linux-x86_64/firefox-79.0b9-beta.tar.bz2, and the move-o-matic bug is still there.
Did the i3/BSPWM fix get undone because of the 1645776 regression?

With which WM where you testing?

All my testing is with Fedora MATE, with _NET_WM_NAME "Metacity (Marco)".

As suggested by https://old.reddit.com/r/archlinux/comments/g7fmz1/i3wm_anyone_have_firefox_window_focusing_issues/,
I have commented out the call to moveToWorkspace() in browser/omni.ja (note that 'firefox --purgecaches' is then required).
I found that both necessary and sufficient for the following versions of firefox:

  • firefox-78.0.2-1.fc32.x86_64 (Fedora RPM package)
  • linux-x86_64/firefox-78.0.2-release.tar.bz2 (Mozilla release tarball)
  • linux-x86_64/firefox-79.0b9-beta.tar.bz2 (Mozilla beta tarball)
Flags: needinfo?(bmj001)

(In reply to Bruce Jerrick from comment #20)

(In reply to wekerbugs from comment #19)

I haven't tried firefox 79 (beta) yet, but what about Fedora MATE, with _NET_WM_NAME "Metacity (Marco)"?

Just tried linux-x86_64/firefox-79.0b9-beta.tar.bz2, and the move-o-matic bug is still there.
Did the i3/BSPWM fix get undone because of the 1645776 regression?

With which WM where you testing?

All my testing is with Fedora MATE, with _NET_WM_NAME "Metacity (Marco)".

As suggested by https://old.reddit.com/r/archlinux/comments/g7fmz1/i3wm_anyone_have_firefox_window_focusing_issues/,
I have commented out the call to moveToWorkspace() in browser/omni.ja (note that 'firefox --purgecaches' is then required).
I found that both necessary and sufficient for the following versions of firefox:

  • firefox-78.0.2-1.fc32.x86_64 (Fedora RPM package)
  • linux-x86_64/firefox-78.0.2-release.tar.bz2 (Mozilla release tarball)
  • linux-x86_64/firefox-79.0b9-beta.tar.bz2 (Mozilla beta tarball)

As Marco is neither i3 nor BSPWM it looks like it works as intended.
With https://phabricator.services.mozilla.com/D84515 we may get a preference disabling it anywhere, for that see Bug 1628742.

(In reply to wekerbugs from comment #21)

With https://phabricator.services.mozilla.com/D84515 we may get a preference disabling it anywhere, for that see Bug 1628742.

Thanks for the reference to D84515; from that I see that I also should have explicitly mentioned that my XDG_CURRENT_DESKTOP == "MATE".
I certainly cast my vote for such a preference (and a prominent mention of such in the Release Notes).

I think this issue is not fixed by excluding certain window managers:

I see a workflow for people glad about not having to arrange their previous sessions, but it is not mine. For me (using awesomewm) it is like I open firefox, see the window for the glimpse of a second before it disappears to some other workspace.

The sensible solution imho would be to add a tickbox in Preferences under "Restore previous session" named "Restore in previous workspace" thus giving the users the agency to decide for their own.

I'm on i3wm and my assign rules don't work with this fix. Please introduce a preference or stop this behaviour. I use a window manager to manage the placement of my windows and don't want that my browser decides where to place which window. It not the job of the browser. It's HIGHLY annoying and I tend to use Chrome more and more often because of this.

(In reply to Lars Becker from comment #24)

I'm on i3wm and my assign rules don't work with this fix. Please introduce a preference or stop this behaviour. I use a window manager to manage the placement of my windows and don't want that my browser decides where to place which window. It not the job of the browser. It's HIGHLY annoying and I tend to use Chrome more and more often because of this.

A preference was added to disable the restore behaviour in bug 1628742. For other issues, please create a new bug.

Depends on: 1679170
Regressions: 1673767
You need to log in before you can comment on or make changes to this bug.