You are not logged in.

#1 2013-05-17 11:39:31

yulan6248
Member
Registered: 2013-04-06
Posts: 28

Find a window in XMonad and apply some actions to it

Hi everyone, I think this should be really easy for someone who's good at Haskell but I just couldn't figure it out as I'm bad at it.

Basically I want to search through the list of windows in the current workspace, find one matching some condition and apply some action to it; if not found then create this window.

I had a skeleton code like this

import qualified XMonad.StackSet as W
import XMonad.Actions.WindowGo

findWindow condition actionIfFound actionIfNotFound = 
    ifWindow (condition <&&> member W.current) windowFound actionIfNotFound
        where windowFound = ask >>= w -> do actionIfFound w

Offline

Board footer

Powered by FluxBB