Search code examples
haskellxmonad

Xmonad shift window to another screen and focus on it with one keybinding


how to make this key binding so that it also focuses on the moved window?

    [((m .|. modm, key), screenWorkspace sc >>= flip whenJust (windows . f))
        | (key, sc) <- zip [xK_h, xK_l] [0..]
        , (f, m) <- [(W.view, 0), (W.shift, shiftMask)]]

Solution

  • Use shiftAndView i = W.view i . W.shift i instead of W.shift like this:

      [((m .|. modm, key), screenWorkspace sc >>= flip whenJust (windows . f))
        | (key, sc) <- zip [xK_h, xK_l] [0..]
        , let shiftAndView i = W.view i . W.shift i
        , (f, m) <- [(W.view, 0), (shiftAndView, shiftMask)]]