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.Hidden doesn't handle deleted windows #907

Open
2 tasks
SheetKey opened this issue Sep 30, 2024 · 2 comments
Open
2 tasks

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

SheetKey opened this issue Sep 30, 2024 · 2 comments

Comments

@SheetKey
Copy link

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)
@TheMC47
Copy link
Member

TheMC47 commented Sep 30, 2024

Will adding an event hook that checks for DestroyWindowEvent fix the issue?

@geekosaur
Copy link
Contributor

It should; that's what it's there fore (after all, you can;'t do anything else with the window ID it includes).

You can validate window ID's, though, by doing what we normally avoid: calling getWindowAttributes (or in our case safeGetWindowAttributes) on it and looking for failure.

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

No branches or pull requests

3 participants