-- Example binding and helpers to cycleRecentWS with nonempty workspaces only import XMonad import qualified XMonad.StackSet as W import XMonad.Actions.CycleRecentWS import XMonad.Util.EZConfig -- optional but used in the example main = xmonad $ defaultConfig { modMask = mod4Mask -- on Super -- skipped } `additionalKeysP` myKeys myKeys = [ ("M-", cycleWindowSets nonEmptyRecents [xK_Super_L] xK_Tab xK_grave) -- skipped ] -- for additionalKeys or default keybinding style -- (modm xK_Tab, cycleWindowSets nonEmptyRecents [xK_Super_L] xK_Tab xK_grave) -- Build a list of windowsets with current swapped in turn with each -- "most recent" workspace as given by nonEmptyTags nonEmptyRecents :: (Eq s, Eq i) => W.StackSet i l a s sd -> [W.StackSet i l a s sd] nonEmptyRecents ws = map (W.view `flip` ws) (rotUp $ nonEmptyTags ws) -- Given a windowset grab a list of the workspace tags, in the default order: -- current, visibles in screen order, hiddens from most to least recently accessed. nonEmptyTags :: W.StackSet i l a s sd -> [i] nonEmptyTags ws = [ tag | W.Workspace tag _ (Just _) <- W.workspaces ws] -- rotUp and rotDown are actually exported by Actions.CycleWindows, -- but written in an unsafe form using head tail init last :(( -- Shall have to send patch to fix that. rotUp :: [a] -> [a] rotUp l = drop 1 l ++ take 1