Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

X.L.PerWorkspace does not send messages to right sublayout until activated #100

Open
f1u77y opened this issue Oct 25, 2016 · 3 comments
Open

Comments

@f1u77y
Copy link
Contributor

f1u77y commented Oct 25, 2016

Here I'll try to make a bit more formal and informative version of #76

Config that reproduces the bug

import XMonad
import XMonad.Util.EZConfig

main = xmonad def { workspaces = ["1", "2"]
                  , layoutHook = onWorkspace "1" tiled tiled
                  } `additionalKeysP` 
                  [ ("M-b", broadcastMessage Expand)
                  ]
  where tiled = Tall 1 (1/2) (1/4)

Steps to reproduce

  1. Start xmonad
  2. Open two windows
  3. Shift them to second workspace
  4. Press "M-b"
  5. Go to second workspace

Actual results

Two windows are half-splitted

Expected results

Left window should occupy 3/4 of width of the screen

My attemt to explain the bug

Definitions

  • A sublayout is one the arguments of PerWorkspace which are instances of LayoutClass
  • An active sublayout is the sublayout which is chosen by the Bool argument of PerWorkspace
  • A layout is activated when runLayout is called first time for it

Explaination

When PerWorkspace on workspace "2" is not activated, its first sublayout is always active(but after activation the second one will be active). So, when we send message to non-activated PerWorkspace, it retranslates it only to first sublayout but we want it to retranslate that message to second sublayout

Possible fixes

  1. Get rid of this module and move its functionality into core(I know you're a bit conservative about changing stuff in core; and this fix still can have some problems(e.g. with dynamic workspaces))
  2. Create third state(for no layout chosen; default state) and accumulate messages for sending them to active sub-layout after activated
  3. Assume that's right behaviour and explicitely state in the docs that sending messages to non-activated layouts is undefined behaviour
  4. Activate each layout after it have been created.
  5. Any other suggestions?
@f1u77y
Copy link
Contributor Author

f1u77y commented Apr 20, 2017

Now I prefer another way(that is close to 4 but is more general): to send some "update" messages to layouts on early startup(just after layouts have been created) and after each WindowSet update(logHook?).

Does anyone has any thought on this?

@geekosaur
Copy link
Contributor

logHook, yes.

We already fire the logHook very early; before the startupHook in fact, at least 4 times judging by my testing.

@f1u77y
Copy link
Contributor Author

f1u77y commented Apr 20, 2017

That's nice, so the only thing we have to do(if it's the right solution) is to send the "update" messages at the same time when we fire logHook and update all layouts when it fires. But it could be expensive, so I'm wary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants