XMonad "toggle" keybind

258 views Asked by At

Hi I'm completely new to XMonad and haskell and I'm having an hard time defining custom function for a keybind.

I'm using XMonad.Actions.TagWindows and I'm trying to define a function that brings windows with a specific tag in the current workspace or send the focused window in a designated workspace if it's tagged. Right now I've achieved this behaviour using two different keybindings.

    , ((0,   xK_KP_Home  ), withTaggedGlobalP "Editor" shiftHere)
    , ((altKPMask,   xK_KP_Home  ), withTaggedP "Editor" (W.shiftWin "Editor"))

This does roughly what I want but I'd like to have a single keybind for it so I tried to define function that checks the tag of the focused window and behaves accordingly and this is what I came up with:

    tagFunc tag w = 
         if hasTag tag w 
         then W.shiftWin tag w 
         else  withTaggedGlobal tag shiftHere

But I got an error stating

Couldn't match expected type `Bool` with actual type `X Bool`

And I don't know how to solve it, I've searched for a way to convert X Bool to Bool with no luck.

Thank you very much in advance.

0

There are 0 answers