diff options
author | Devin Mullins <me@twifkak.com> | 2007-10-12 16:54:47 +0200 |
---|---|---|
committer | Devin Mullins <me@twifkak.com> | 2007-10-12 16:54:47 +0200 |
commit | 1254dd41509a031008799cb6850181705eae320b (patch) | |
tree | f758dfc093091880186e90fbcd38e6019123bc96 | |
parent | db56cbb7ed63d02e70ecc24ab88a0342d1c99c5e (diff) | |
download | XMonadContrib-1254dd41509a031008799cb6850181705eae320b.tar.gz XMonadContrib-1254dd41509a031008799cb6850181705eae320b.tar.xz XMonadContrib-1254dd41509a031008799cb6850181705eae320b.zip |
haddock improvement
darcs-hash:20071012145447-78224-ddfc6b2085e85d92547aac3fc027c0dd4bad9cd3.gz
-rw-r--r-- | SwapWorkspaces.hs | 9 | ||||
-rw-r--r-- | WindowBringer.hs | 20 |
2 files changed, 17 insertions, 12 deletions
diff --git a/SwapWorkspaces.hs b/SwapWorkspaces.hs index a6aff7e..277ae6a 100644 --- a/SwapWorkspaces.hs +++ b/SwapWorkspaces.hs @@ -12,9 +12,7 @@ -- each other, without having to move individual windows. -- -- TODO: add quickcheck props for: --- -- * double swap invariant (guarantees no 'loss' of workspaces) --- -- * non-swapped ws's invariant -- ----------------------------------------------------------------------------- @@ -43,10 +41,17 @@ import StackSet -- %keybindlist ++ -- %keybindlist [((modMask .|. controlMask, k), windows $ swapWithCurrent i) -- %keybindlist | (i, k) <- zip workspaces [xK_1 ..]] +-- +-- After installing this update, if you're on workspace 1, hitting mod-ctrl-5 +-- will swap workspaces 1 and 5. +-- | Swaps the currently focused workspace with the given workspace tag, via +-- @swapWorkspaces@. swapWithCurrent :: Eq i => i -> StackSet i l a s sd -> StackSet i l a s sd swapWithCurrent t s = swapWorkspaces t (tag $ workspace $ current s) s +-- | Takes two workspace tags and an existing StackSet and returns a new +-- one with the two corresponding workspaces' tags swapped. swapWorkspaces :: Eq i => i -> i -> StackSet i l a s sd -> StackSet i l a s sd swapWorkspaces t1 t2 = mapWorkspace swap where swap w = if tag w == t1 then w { tag = t2 } diff --git a/WindowBringer.hs b/WindowBringer.hs index e58fc26..7dc884a 100644 --- a/WindowBringer.hs +++ b/WindowBringer.hs @@ -9,6 +9,8 @@ -- Portability : unportable -- -- dmenu operations to bring windows to you, and bring you to windows. +-- That is to say, it pops up a dmenu with window names, in case you forgot +-- where you left your XChat. -- ----------------------------------------------------------------------------- @@ -31,9 +33,6 @@ import XMonadContrib.Dmenu (dmenuMap) import XMonadContrib.NamedWindows (getName) -- $usage --- WindowBringer brings windows to you and you to windows. --- That is to say, it pops up a dmenu with window names, in case you forgot --- where you left your XChat. -- -- Place in your Config.hs: -- @@ -49,35 +48,36 @@ import XMonadContrib.NamedWindows (getName) -- %keybind ((modMask .|. shiftMask, xK_b ), bringMenu) -- | Pops open a dmenu with window titles. Choose one, and you will be --- taken to the corresponding workspace. +-- taken to the corresponding workspace. gotoMenu :: X () gotoMenu = workspaceMap >>= actionMenu (windows . W.greedyView) where workspaceMap = windowMapWith (W.tag . fst) -- | Pops open a dmenu with window titles. Choose one, and it will be --- dragged, kicking and screaming, into your current workspace. +-- dragged, kicking and screaming, into your current workspace. bringMenu :: X () bringMenu = windowMap >>= actionMenu (windows . bringWindow) where windowMap = windowMapWith snd bringWindow w ws = W.shiftWin (W.tag . W.workspace . W.current $ ws) w ws -- | Calls dmenuMap to grab the appropriate element from the Map, and hands it --- off to action if found. +-- off to action if found. actionMenu :: (a -> X ()) -> M.Map String a -> X () actionMenu action windowMap = dmenuMap windowMap >>= flip X.whenJust action -- | Generates a Map from window name to <whatever you specify>. For use with --- dmenuMap. TODO: extract the pure, creamy center. +-- dmenuMap. windowMapWith :: ((X.WindowSpace, Window) -> a) -> X (M.Map String a) -windowMapWith value = do +windowMapWith value = do -- TODO: extract the pure, creamy center. ws <- gets X.windowset M.fromList `fmap` concat `fmap` mapM keyValuePairs (W.workspaces ws) where keyValuePairs ws = mapM (keyValuePair ws) $ W.integrate' (W.stack ws) keyValuePair ws w = flip (,) (value (ws, w)) `fmap` decorateName ws w -- | Returns the window name as will be listed in dmenu. --- Lowercased, for your convenience (since dmenu is case-sensitive). --- Tagged with the workspace ID, to guarantee uniqueness, and to let the user know where he's going. +-- Lowercased, for your convenience (since dmenu is case-sensitive). +-- Tagged with the workspace ID, to guarantee uniqueness, and to let the user +-- know where he's going. decorateName :: X.WindowSpace -> Window -> X String decorateName ws w = do name <- fmap (map toLower . show) $ getName w |