baskerville / bspwm

A tiling window manager based on binary space partitioning
BSD 2-Clause "Simplified" License
7.8k stars 415 forks source link

Firefox-esr opening in other desktop after moving it #1423

Closed root2185 closed 1 year ago

root2185 commented 2 years ago

After I send it to some desktop with bspc {desktop -f,node -d} '^{1-9,10}' it keeps opening there. I have no rule to place it in some desktop, no rule at all.

Example: I am on D1 and I open it, I send it to D2. I close it and I go back to D1. Now it opens on D2 even if I am on D1.

I tried to add a rule to follow but it is ignored: bspc rule -a Firefox-esr desktop=focused follow=on focus=on.

Also desktop=focused is ignored, the behavior is the same as before.

bspwm version: 0.9.10-2+b1
OS: Debian GNU/Linux 11
Darukutsu commented 2 years ago

Have you tried firefox-esr instead Firefox-esr

These rules don't work for me, in bspwmrc

bspc config ignore_ewmh_focus    true
bspc rule -a firefox desktop=focused focus=on

I came with workaround. Since firefox get focus, then lose it and it appears on another desktop without switching focus to another desktop, you can do this in sxhkdrc:

# focus and move 'older' firefox to focused desktop
super + a
bspc node older -f; bspc node -d last --follow

ignore_ewmh_focus should be working if firefox asks for focus desktop/workspace but not sure because I've read about it on reddit.

root2185 commented 2 years ago

I use that because of:

xprop WM_CLASS
WM_CLASS(STRING) = "Navigator", "Firefox-esr"

That's how other entries in the example are made. I can use a rule to open firefox on a desktop e.g. desktop 8, with that: bspc rule -a ... desktop='^8' ...

I ran bspc config ignore_ewmh_focus true same as before.

Can I use one command to open and move firefox?

super + a
    firefox-esr; bspc node older -f; bspc node -d last --follow
ortango commented 1 year ago

fyi: this is normal firefox behavior when using restore session. you should be able to use the about:config preference, widget.disable-workspace-management. you can also disable the feature completely in SessionStore.jsm if you run into other issues (or is firefox-esr doesn't have this config).

root2185 commented 1 year ago

I set widget.disable-workspace-management true and now firefox stays in the desktop where I open it.

But it is moving a window from another desktop there, when I open it.

Where can I find SessionStore.jsm? I found this https://sources.debian.org/src/firefox-esr/91.11.0esr-1~deb11u1/toolkit/components/sessionstore/SessionStoreFunctions.jsm/. Is it in the source code?

Darukutsu commented 1 year ago

In my case it really helped to set widget.disable-workspace-management to true. Are you sure other rules or shortcuts aren't interfering. I'm using classic firefox. Has firefox-esr persistent config?

ortango commented 1 year ago

@Scorpion2185

that link is dead for me, 91.11 seems gone. 91.13 here @ debian. in the browser directory rather then toolkit

root2185 commented 1 year ago

@Darukutsu With that true firefox stays where I open it. But the last focused window of the previous desktop is moved there.

I have few rules I tried apps without them. It happens when closing firefox-esr.

Persistent config? Not sure.

@ortango Sorry wrong link, this is the version that I have: https://sources.debian.org/src/firefox-esr/102.5.0esr-1/browser/components/sessionstore/SessionStore.jsm/. So do I need to recompile it?

aptitude build-dep -s firefox-esr
Unable to satisfy the build-depends: Build-Depends: libnspr4-dev (>= 2:4.32~)
Unable to satisfy the build-depends: Build-Depends: libnss3-dev (>= 2:3.79.1~)
Unable to satisfy the build-depends: Build-Depends: rustc (>= 1.59)
Unable to satisfy the build-depends: Build-Depends: cargo (>= 0.57)
Unable to apply some actions, aborting
ortango commented 1 year ago

So do I need to recompile it?

you can unpack the version from the already built package, edit it and repack the archive instead. i've written basic instructions here on reddit you may only be interested in disabling movetoWorkspace instead of the size issue i'm describing there.


note: it looks like the version of firefox you are using should support widget.disable-workspace-management

root2185 commented 1 year ago

@ortango yes if I set widget.disable-workspace-management true firefox stays where I open it. But the last focused window of the previous desktop is moved there. It happens when closing firefox-esr.

So no point in edit the SessionStore.jsm file?

Is this a firefox bug then?

ortango commented 1 year ago

So no point in edit the SessionStore.jsm file?

no i don't think there is.

sounds like such an odd issue. i will install firefox-esr later and try to recreate the issue.

just to confirm:

i don't know that it would matter, but makes me curious:

Is this a firefox bug then?

not sure at all.

root2185 commented 1 year ago

the issue has become that on closing firefox-esr a last focused window from the previous desktop will move to the desktop firefox-esr was on?

Yes the last focused window from the previous desktop is moved to the desktop firefox-esr was on. Even If the last focused window is on the same desktop, the last of the other is moved.

Sometimes a window from the dekstop firefox-esr was on is moved on another desktop (when you close firefox-esr). The latter desktop is focused when this happens. If you have many windows opened quirky things happen.

you are using session restore in firefox?

Yes, in Settings (about:preferences) I have enabled Open previous windows and tabs.

does the last window move to the place firefox was at? or just the desktop?

Yes, it moves to the place firefox-esr was at.

if you close firefox while on another desktop does the window still move? where, the focused desktop or the desktop firefox was on?

Yes, it moves to the place firefox-esr was at.

ortango commented 1 year ago

i ran firefox-esr for awhile and was never was able to get anything like you are seeing to happen.

does the last window move to the place firefox was at? or just the desktop?

Yes, it moves to the place firefox-esr was at.

that makes me think maybe something else entirely is going on? firefox should have no idea about the tree layout of bspwm and at best should be able to move the window to a desktop, but not a node position.

root2185 commented 1 year ago

Not always sometimes firefox-esr moves it to another desktop or just the desktop etc. But it may be possible that something is wrong with my system.

Edit: After setting widget.disable-workspace-management to true and reverting other changes it is fixed.