Skip to content

X.L.Hidden doesn't handle deleted windows #907

Open
@SheetKey

Description

@SheetKey

Problem Description

When a hidden window is deleted, the Window is not deleted from the HiddenWindows list. Restoring the window calls insertUp on a window id that does not correspond to a window. This inserts and focuses an empty rectangle. The rectangle cannot be deleted. While focused, it can be hidden. It cannot be manually focused; to regain focus I have to move any other windows in the workspace to a different workspace.

From what I can tell, there may not be a simple solution. It seems like X11 does not provide a way to check if a window id is valid, so we can't validate hidden window ids with X11. Since W.delete' is called, xmonad core does not keep track of the window while it is hidden, so we can't just use isClient. Perhaps hidden windows need to be handled similarly to floating windows.

Steps to Reproduce

Spawn a program, hide the window, kill the program from the terminal. Restore the hidden, but deleted window.

Configuration File

import XMonad

import XMonad.Layout.BinarySpacePartition

-- layouts modifiers
import XMonad.Layout.NoBorders (lessBorders, Ambiguity(OnlyScreenFloat))
import qualified XMonad.Layout.Hidden as H

main :: IO ()
main = do
  xmonad $
    def
    { modMask = mod4Mask
    , layoutHook = myLayout
    , terminal = "alacritty"
    , startupHook = myStartupHook
    , keys = testKeys
    }

testKeys :: XConfig Layout -> M.Map (KeyMask, KeySym) (X ())
testKeys c = mkKeymap c $
  [ ("M-<Return>", spawn $ terminal c)
  , ("M-x", spawn "rofi -show run")
  -- hide windows
  , ("M-h", withFocused H.hideWindow)
  , ("M-C-h", H.popNewestHiddenWindow)
  ]
    
myLayout = transformLayout $ emptyBSP ||| tallLeft
  where
    tallLeft = Tall 1 (3/100) (1/2)

transformLayout = id
  . avoidStruts
  . H.hiddenWindows
  . lessBorders OnlyScreenFloat

Checklist

xmonad --version does not work (Nixos issue?) so I don't know the version, but I'm on Nixos unstable.

  • I tested my configuration
    • With xmonad version XXX (commit XXX if using git)
    • With xmonad-contrib version XXX (commit XXX if using git)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions