How Do I Make a Program Wait In Haskell

252 Views Asked by At

I have a pretty small laptop screen, and I normally use my applications in a fullscreen/monocle layout. However this makes it difficult to remember where exactly my applications are in the stack, since I cant see them.

To solve this problem, I would like to have xmonad automatically make a window go to the top of the stack after I have focused it for a certain amount of time. Kind of like how Android manages its applications.

I am trying my best to accomplish this with the following hook. However I just don't know enough about haskell to make this work.

hook :: Event -> X All
hook (AnyEvent {ev_event_type = et}) = do
  when (et == focusIn) $
        withWindowSet(\ws -> 
           let focused = W.peek ws
           timeout 1000000
           if (focused == W.peek ws) then promote else ws 
        )
  return (All True)
hook _ = return (All True)

I am a newbie at this, and I would really appreciate some suggestions, this has been bugging me for a while, and you'd really be doing me a favor. :D

0

There are 0 best solutions below