xmonad / xmonad-contrib

Contributed modules for xmonad
https://xmonad.org
BSD 3-Clause "New" or "Revised" License
589 stars 274 forks source link

Windows spawned on a Layout.SimpleFloat workspace does not move with the workspace (multi-monitor setup)kspace #140

Closed jonascj closed 7 years ago

jonascj commented 7 years ago

Problem Description

With a multi-monitor setup, i.e. multiple outputs setup with xrandr, Windows spawned on a workspace using XMonad.Layout.SimpleFloat stay on the monitor where the workspace was when they were spawned, even though the workspace is no longer displayed on that monitor.

This video demonstrates the problem: http://i.imgur.com/Fz9ZXON.mp4

Tested with XMonad 0.12 on Ubuntu 16.04, and the latest git version on Arch Linux, same result.

The video is based on the below config, except I added xmobar and logging as well to make identifying workspaces easier. The two screens are my laptop monitor (lowest resolution on the left) and an external monitor (highest resolution on the right).

Workspace 2 uses SimpleFloat as layout. I spawn a few windows on WS2 while it is visible on the ext/right monitor. When I switch back to the laptop/left monitor (mod+w) and request WS2 be displayed there (mod+2) the windows just spawned remain on the external monitor and overlay any other windows now visible there. The only way to not have the floated windows visible is to make sure no monitor is displaying WS2, I do that in the end of the video where I switch to WS1 and WS3 on the two monitors, making the float Windows disappear. See the list at the end of the post for the exact keystrokes.

Windows floated with mod+mouse on workspaces without the SimpleFloat layout they move with their workspace as expected.

XMonad.Layout.SimplestFloat does not seem to suffer from this problem, but it is also quite different, behaves more like mod+mouse floated windows, i.e. the windows in SimplestFloat layouts can not be moved without mod+mouse and they can not be mouse resized.

Configuration File

import XMonad
import qualified XMonad.Layout.PerWorkspace as PerWS
import qualified XMonad.Layout.SimpleFloat as Float

main = xmonad defaultConfig
        {  modMask = mod4Mask -- Use Super instead of Alt
         , layoutHook =    PerWS.onWorkspace "2" Float.simpleFloat 
                         $ (Tall 1 (3/100) (1/2) ||| Full) 
        }

Checklist

Appendix

The keystrokes used in video for changing monitors and workspaces

  1. mod-e (focus right monitor)
  2. spawn windows and rearrange with mouse
  3. mod-w (focus left monitor)
  4. mod-2 (viewing WS2 on laptop monitor, but windows stay on right monitor)
  5. mod-1 , mod-2 , mod-1 (try again to get the windows moving)
  6. mod-e (focus right monitor)
  7. mod-1 (view WS1 on right monitor)
  8. mod-w (focus left monitor)
  9. mod-3 (view WS3 on left monitor, now the float windows are not visible because WS2 is not visible anywhere)
  10. Float and drag the window in WS1 (right monitor) to verify the floated windows are not hiding there
  11. mod-w (focus left monitor)
  12. mod-2 (view WS2 on left monitor, floated windows reappear on the right monitor even though WS2 is not displayed there).
geekosaur commented 7 years ago

Sadly, that's more or less expected. Our floating window handling is atrocious.

On Wed, Jan 25, 2017 at 5:57 PM, Jonas Camillus Jeppesen < notifications@github.com> wrote:

Problem Description

With a multi-monitor setup, i.e. multiple outputs setup with xrandr, Windows spawned on a workspace using XMonad.Layout.SimpleFloat stay on the monitor where the workspace was when they were spawned, even though the workspace is no longer displayed on that monitor.

This video demonstrates the problem: http://i.imgur.com/Fz9ZXON.mp4

The video is based on the below config, except I added xmobar and logging as well to make identifying workspaces easier. The two screens are my laptop monitor (lowest resolution on the left) and an external monitor (highest resolution on the right).

Workspace 2 uses SimpleFloat as layout. I spawn a few windows on WS2 while it is visible on the ext/right monitor. When I switch back to the laptop/left monitor (mod+w) and request WS2 be displayed there (mod+2) the windows just spawned remain on the external monitor and overlay any other windows now visible there. The only way to not have the floated windows visible is to make sure no monitor is displaying WS2, I do that in the end of the video where I switch to WS1 and WS3 on the two monitors, making the float Windows disappear. See the list at the end of the post for the exact keystrokes.

Windows floated with mod+mouse on workspaces without the SimpleFloat layout they move with their workspace as expected.

XMonad.Layout.SimplestFloat does not seem to suffer from this problem, but it is also quite different, behaves more like mod+mouse floated windows, i.e. the windows in SimplestFloat layouts can not be moved without mod+mouse and they can not be mouse resized. Configuration File

import XMonadimport qualified XMonad.Layout.PerWorkspace as PerWSimport qualified XMonad.Layout.SimpleFloat as Float

main = xmonad defaultConfig { modMask = mod4Mask -- Use Super instead of Alt , layoutHook = PerWS.onWorkspace "2" Float.simpleFloat $ (Tall 1 (3/100) (1/2) ||| Full) }

Checklist

-

[X ] I've read CONTRIBUTING.md https://github.com/xmonad/xmonad/blob/master/CONTRIBUTING.md

[ ] I tested my configuration with xmonad-testing https://github.com/xmonad/xmonad-testing No, it isn't really suited for multi-monitor testing, but did test with newest git on ArchLinux, and version 0.12 on Ubuntu 16.04. geekosaur suggests XMonad.Layout.LayoutScreens might work, but agrees that it ruins testing a bit since it requires modification of xmonad.hs

Appendix

The keystrokes used in video for changing monitors and workspaces

  1. mod-e (focus right monitor)
  2. spawn windows and rearrange with mouse
  3. mod-w (focus left monitor)
  4. mod-2 (viewing WS2 on laptop monitor, but windows stay on right monitor)
  5. mod-1 , mod-2 , mod-1 (try again to get the windows moving)
  6. mod-e (focus right monitor)
  7. mod-1 (view WS1 on right monitor)
  8. mod-w (focus left monitor)
  9. mod-3 (view WS3 on left monitor, now the float windows are not visible because WS2 is not visible anywhere)
  10. Float and drag the window in WS1 (right monitor) to verify the floated windows are not hiding there
  11. mod-w (focus left monitor)
  12. mod-2 (view WS2 on left monitor, floated windows reappear on the right monitor even though WS2 is not displayed there).

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/xmonad/xmonad-contrib/issues/140, or mute the thread https://github.com/notifications/unsubscribe-auth/AB8SoNd6QBvjg4ie5gLfy6cc3BY5jkXBks5rV9NWgaJpZM4LuGu8 .

-- brandon s allbery kf8nh sine nomine associates allbery.b@gmail.com ballbery@sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net

jonascj commented 7 years ago

According to this old comment on reddit windows which appear floating in SimpleFloat layout is not actually floating according to xmonad internals, its some hack making it appear so. https://www.reddit.com/r/xmonad/comments/hktyb/ask_rxmonad_decorated_floating_windows/c20bzv5/

Maybe that is why it is not working, but mod+mouse floated windows work, and Layout.SimplestFloat works.

There is also a pull request on the xmonad repo concerning advanced decoration and floating: https://github.com/xmonad/xmonad/pull/41

Maybe that will be interesting in the future.

In summary: I might just forget all about Layout.SimpleFloat and use Layout.SimplestFloat instead.

pjones commented 7 years ago

XMonad.Layout.WindowArranger is the problem IMO. I think that we need a new issue for improving the documentation on most layouts and make it clear that XMonad.Layout.WindowArranger and any other layout using it keeps all windows in the floating layer.

I'm going to close this issue and open another one.