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

Display bug with IfMax, PerScreen, PerWorkspace with decorated layouts #75

Open
thblt opened this issue Aug 15, 2016 · 17 comments · May be fixed by #825
Open

Display bug with IfMax, PerScreen, PerWorkspace with decorated layouts #75

thblt opened this issue Aug 15, 2016 · 17 comments · May be fixed by #825

Comments

@thblt
Copy link
Member

thblt commented Aug 15, 2016

When using IfMax with a decorated layout, the decorations appear on other workspaces, even over other windows, if the other workspace uses a different layout, and the decorations don't disappear on a given workspace if the layout is changed by IfMax.

This basic LayoutHook exhibits the bug:

myLayoutHook = IfMax 1 Full $ noFrillsDeco shrinkText def $ emptyBSP

This seems to be specifically related to IfMax, since using ToggleLayouts with the same two layouts doesn't display this behavior.

2016-08-15-164427_2560x1440_scrot

2016-08-15-164453_2560x1440_scrot

2016-08-15-164620_2560x1440_scrot

@thblt
Copy link
Member Author

thblt commented Aug 15, 2016

In fact, the problem appears when leaving a decorated layout controlled by IfMax, even if not from IfMax. Going to Full with a ToggleLayout, if toggling between full and IfMax n a b, exhibits the same behavior. I'd say, although I'm not sure, that leaving in any way any decorated layout controlled by IfMax leads to the same problem.

I had a look at the code to try and understand the difference between IfMax and ToggleLayouts, but couldn't spot the origin of the problem.

@geekosaur
Copy link
Contributor

On Mon, Aug 15, 2016 at 12:39 PM, Thibault notifications@github.com wrote:

In fact, the problem appears when leaving a decorated layout controlled by
IfMax, even if not from IfMax. Going to Full with a ToggleLayout, if
toggling between full and IfMax n a b
, exhibits the same behavior. I'd
say, although I'm not sure, that leaving in any way any decorated layout
controlled by IfMax leads to the same problem.

Have you tried it with a layout not controlled by IfMax? Decoration has
some known bugs where it does not clean up after itself properly, and
ToggleLayout is likely to provoke them. And it is entirely possible that
layout modifiers --- not just IfMax, but any conditional layout modifier
--- would make these worse by not allowing what cleanup it does to happen.

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

@thblt
Copy link
Member Author

thblt commented Aug 18, 2016

Thanks for your answer. Layouts not controlled by IfMax switches from decorated to undecorated without any visible problems: myLayoutHook = toggleLayouts Full $ noFrillsDeco shrinkText def $ emptyBSP works perfectly. NoFrills is my decorated layout of choice, but not the only one with the bug: I tried with some others, and all are affected as long as they're controlled by IfMax, but none with ToggleLayouts alone. I also tried using the git version of IfMax, with same results.

I'll write a few MWEs, so you can see if the bug is reproductible. I'm using latest packaged XMonad (from main repositories) on an up-to-date ArchLinux.

@f1u77y
Copy link
Contributor

f1u77y commented Aug 20, 2016

there are some fixes in X.L.IfMax in master, try it. 0.12 hasn't that fixes

@thblt
Copy link
Member Author

thblt commented Aug 21, 2016

@f1u77y : As I said in my previous message, I already tried with the git version of IfMax, not the full git xmonad-contrib though.

I'll write a MWE later today.

@f1u77y
Copy link
Contributor

f1u77y commented Aug 21, 2016

couldn't you give your conf? i experienced sort of that bug and thought it was fixed in master
UPD: ahh found that case in topic, will try to reproduce

@thblt
Copy link
Member Author

thblt commented Aug 21, 2016

Hi again,

Here's a MWE, as promised:

import XMonad
import XMonad.Config.Azerty
import XMonad.Layout.BinarySpacePartition (emptyBSP, ResizeDirectional(..), SelectMoveNode(..), Rotate(Rotate))
import XMonad.Layout.IfMax
-- import MyIfMax
import XMonad.Layout.NoFrillsDecoration
import XMonad.Layout.ToggleLayouts (toggleLayouts, ToggleLayout (ToggleLayout))

myLayoutHook = IfMax 1 Full $ noFrillsDeco shrinkText def emptyBSP

main :: IO ()
main = do
  xmonad azertyConfig {
    terminal = "urxvt"
    , layoutHook = myLayoutHook
    }

Apologies for using AzertyConfig: feel free to replace with def. This is the version I've been testing with.

With this MWE, and using git IfMax (imported as MyIfMax):

  • When reducing the number of windows on a given workspace below IfMax's threshold, decorations correctly disappear (this is not the case with packaged IfMax). OK.
  • When switching from a decorated workspace (that is, a workspace with number of windows above threshold, triggering use of decorated layout) to another decorated workspace, the decorations change according to the new workspace layout. OK.
  • When switching from a decorated workspace to another, undecorated workspace, either empty or with only 1 window, the decorations remain visible above the background or the single window.

@f1u77y, FWIW, my full config is here, but this one doesn't use IfMax, so shouldn't be of any help.

@f1u77y
Copy link
Contributor

f1u77y commented Aug 21, 2016

i think i got the problem. IfMax gets number of windows from other workspace when it handles the Hide message. will try to fix

UPD: as i can see, we cannot get the number of the windows on the workspace where layout runs in handleMessage(when this workspace is not focused). but we need it to handle messages correctry. i can propose a workaround(handle Hide messages separately) but other messages sent to inactive layouts will cause other bugs with IfMax. so, i don't have any idea for fixing it now(except breaking api), maybe @geekosaur can give a tip on this

@thblt
Copy link
Member Author

thblt commented Aug 22, 2016

Thanks for looking into it! By the way, what I'm actually trying to achieve is to have decorations if and only if there's more than one (non-floating) window in the current workspace. I really prefer decorations over borders to indicate focus. If you have any idea :-) I'm currently doing this with a custom MultiToggle Transformer, but that's obviously not automatic.

@f1u77y
Copy link
Contributor

f1u77y commented Aug 23, 2016

you can use X.L.IfMax version with a workaround as a temporary solution but you can experience other problems with messages(e.g. struts may work badly or smth else)

@thblt
Copy link
Member Author

thblt commented Aug 26, 2016

I just tried it, it seems to work perfectly, including struts (XMobar), toggling them, and layout messages. I haven't tested exhaustively, but everything in this config seems to work well.
Thanks again!

@pjones
Copy link
Contributor

pjones commented Feb 7, 2017

@f1u77y Did your fixes for X.L.IfMax make it into xmonad-contrib?

@f1u77y
Copy link
Contributor

f1u77y commented Feb 12, 2017

@pjones that fix is just a workaround. Layout should know, what(in this case at least how many) windows are there on its workspace at every moment; that's the only way that allows to fix this bug.

@geekosaur
Copy link
Contributor

Weeding old stuff in my inbox... how completely should it need to know this, @f1u77y ? Because some things require actually running the layout, and you can't do that if it's not displayed. (Notably, if I doShift in the manageHook, this increases the number of windows in the layout without notifying it; layouts only "exist" when rendering a workspace, not when manipulating the StackSet.)

@willbush
Copy link

willbush commented Aug 2, 2020

I just countered the same issue in version 0.16. I haven't tried the work around yet.

@willbush
Copy link

willbush commented Aug 2, 2020

I decided to go with the approach shared here: https://www.reddit.com/r/xmonad/comments/glkc6r/can_xmonad_apply_window_decorations_nofrillsdeco/fqy1vda/
Here's the commit where I added it to my config in case anyone is wondering how to add and use it.
willbush/system@0b502f9

@liskin
Copy link
Member

liskin commented Jul 26, 2021

I think the correct way to fix this is to add an L | R field (state) to the IfMax data type so that handleMessage doesn't need to guess which one of the two layouts is active.

That being said, @f1u77y's workaround is probably quite safe as well, as sending extra Hide messages shouldn't harm anything, and is actually being done by IfMax's runLayout function all the time. But propagation of other messages to IfMax layouts on inactive (visible/hidden) workspaces is entirely broken still.

I'm not an IfMax user myself so this is low-prio for me but I'd be happy to review/mentor any efforts towards fixing this.

@liskin liskin changed the title Display bug with IfMax with decorated layouts Display bug with IfMax, PerScreen, PerWorkspace with decorated layouts Oct 28, 2021
@slotThe slotThe linked a pull request Aug 23, 2023 that will close this issue
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants