xmonad / xmonad-contrib

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

X.L.Hidden and toggle fullscreen not working properly #603

Closed ixzh closed 3 years ago

ixzh commented 3 years ago

Problem Description

full-screen not working with hidden windows

Steps to Reproduce

  1. hide some windows
  2. focus on any window and toggle it full-screen
  3. some hidden window will be toggled full-screen, and toggle again, all the hidden windows are restored.

Expected behavior: the focused window should go full screen, and toggle again, the hidden windows should remain hidden.

Configuration File

import XMonad.Layout.Hidden
myLayout =
                   mkToggle (NBFULL ?? NOBORDERS ?? EOT) .
                   hiddenWindows $
                   myDefaultLayout
     where
            myDefaultLayout = tall

, ((modMask, xK_f), sendMessage $ Toggle NBFULL )
, ((modMask, xK_x), withFocused hideWindow)

main :: IO ()
main = do
    xmonad $ desktopConfig {
    layoutHook = myLayout
}

Checklist

slotThe commented 3 years ago

As per the instructions in the issue template

Please include the smallest full configuration file that reproduces the problem you are experiencing:

please try to post "copy pasteable" configuration files:

import XMonad
import XMonad.Layout.Hidden
import XMonad.Layout.MultiToggle
import XMonad.Layout.MultiToggle.Instances
import XMonad.Util.EZConfig

myLayout = mkToggle (NBFULL ?? NOBORDERS ?? EOT)
         . hiddenWindows
         $ Tall 1 (3/100) (1/2)

main :: IO ()
main = xmonad $ def { layoutHook = myLayout }
 `additionalKeysP` [ ("M-f", sendMessage $ Toggle NBFULL)
                   , ("M-x", withFocused hideWindow)
                   ]

The issue here seems to be that hideWindow (as per its documentation) hides windows "from the current layout" and not in general. The NBFULL toggle, however, just switches to noBorders Full (which is not and really can't be part of the current layout). In effect, we have changed the current layout and thus the previously hidden windows become visible again.

Indeed, I'm not sure this is "fixable" on the X.L.MultiToggle side because transform—by design—returns a modified layout and does not just execute an action on the current layout.

ixzh commented 3 years ago

clear explanation!😯 so X.L.Hidden was meant to be used as a cut paste method within a layout? any workaround to make it persistent across layouts? now any layout switch makes hidden windows visible

slotThe commented 3 years ago

On Wed, Sep 22 2021 10:58, HALS wrote:

so technically not an issue?

Indeed; at least I think that any potential "fix" would introduce lots of regressions that really aren't worth it.

any workaround?

You could add noBorders Full to your layout, keep track of the most recently used single layout in some extensible state and then bind some key to either switch to noBorders Full or (if already there) toggle back to the previous layout. Not sure if there is a more elegant solution