baskerville / bspwm

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

Chrome doesn't resize when tab dragged into new window #627

Open bcspragu opened 7 years ago

bcspragu commented 7 years ago

If I have a single Chrome window that fills the screen, and I drag one tab out, it'll correctly split the screen and create a new window. However, the new Chrome window doesn't resize along with this, it's rendered like a full-width window, but half occluded by the other Chrome window. This could very well be a Chrome bug (this works fine in Firefox), but it seems like a resize event isn't being sent to Chrome correctly.

alkeryn commented 7 years ago

I do not have this issue though i would like that you can put back a floating windows in chrome and also that when you pop it out i is in floating

msteen commented 7 years ago

@Alkeryn You should be able to put back a tab, just click and drag the tab back in the other window. To have the window float when you pop it out, you could use the following script:

#!/usr/bin/env bash

# node_manage <monitor_id> <desktop_id> <node_id> <ip_id>
bspc subscribe node_manage | while read -r _ _ _ wid iid; do
  if ! class=$(xprop -id $iid 8s '$0+\n' WM_CLASS 2>/dev/null); then
    continue
  fi
  class=${class#*\"}
  class=${class%%\"*}
  if [[ $class == 'chromium-browser' || $class == 'google-chrome' ]]; then
    bspc node $wid --state floating
  fi
done
alkeryn commented 7 years ago

Well it didn't worked when i put the comment but a newer version fixed it and it work by itself but thank for the script ^^

bcspragu commented 7 years ago

This issue was closed, though Alkeryn's issue was only tangentially related to the initial issue. The initial issue hasn't actually been resolved.

msteen commented 7 years ago

A variant of this problem is also present in Firefox where if you restore a session it will resize the window to its original size. So if you close the session with the window taking half the screen, and restore in with the full screen available, the window will be correctly full screen, but the contents will be drawn (fully functional) as if the window was half the screen.

After Firefox has completely loaded, setting its state to pseudo_tiled will redraw Firefox to fit the contents (the functional bit), even if the contents overflow the space that is available to the tile. Is this overflowing behavior the normal behavior or could this be a bug? I would expect pseudo_tiled windows to still be limited to the space available within its tile.

I tried i3 and XMonad as well and they have the same problem, so it is not specific to bspwm. I also checked xev with -root and -id <firefox_win_id> and neither gave any useful event information that could have been leveraged to trigger a redraw.

It looks like a bug in Firefox, Chrome and some others, which cause problems in all tiling window manager. I cannot reproduce your Chrome resize issue, but the one in Firefox only allows for correct resizing of the window once the restored page has been fully loaded. So I do not see how the window manager could create a general fix for these issues, especially since it does not seem like there is any trigger/event/callback that could be leveraged.

For now I just use this to trigger a resize:

super + r
  bspc node --state pseudo_tiled; \
  sleep 0.1; \
  bspc node --state tiled

Here is another example of this kind of problem, this time in VMWare Player: https://stackoverflow.com/questions/17468078/trigger-resize-event-for-an-x-window

The session restore resize issue in Firefox has been a known bug for quite some while: https://bugzilla.mozilla.org/show_bug.cgi?id=686747 https://bugzilla.mozilla.org/show_bug.cgi?id=1344553

baskerville commented 7 years ago

Is this overflowing behavior the normal behavior or could this be a bug? I would expect pseudo_tiled windows to still be limited to the space available within its tile.

This is expected but I won't mind constraining pseudo-tiled windows to their tiling space.

msteen commented 7 years ago

@baskerville Alright, that would be great, but maybe make it optional, because there might be users that leverage this behavior.