diff options
author | gwern0 <gwern0@gmail.com> | 2008-04-01 04:31:30 +0200 |
---|---|---|
committer | gwern0 <gwern0@gmail.com> | 2008-04-01 04:31:30 +0200 |
commit | 7cd609459f3fcc7b348a55d84306ba4ea0b49593 (patch) | |
tree | 383cc4c839fa2fce6c13e9e9d9c09fc1275d1a90 /XMonad | |
parent | 601ec184de8ea6a603fe4a57047cba264b8fbd0f (diff) | |
download | XMonadContrib-7cd609459f3fcc7b348a55d84306ba4ea0b49593.tar.gz XMonadContrib-7cd609459f3fcc7b348a55d84306ba4ea0b49593.tar.xz XMonadContrib-7cd609459f3fcc7b348a55d84306ba4ea0b49593.zip |
improve WindowGo.hs Haddock formatting
darcs-hash:20080401023130-f7719-d1a353d78e7e97f194403dc9e9331374450fa276.gz
Diffstat (limited to 'XMonad')
-rw-r--r-- | XMonad/Actions/WindowGo.hs | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/XMonad/Actions/WindowGo.hs b/XMonad/Actions/WindowGo.hs index 1bf1c26..8bcedb4 100644 --- a/XMonad/Actions/WindowGo.hs +++ b/XMonad/Actions/WindowGo.hs @@ -43,15 +43,15 @@ and define appropriate key bindings: > , ((modMask x .|. shiftMask, xK_g), raise (className =? "Firefox")) > , ((modMask x .|. shiftMask, xK_b), runOrRaise "firefox" (className =? "Firefox")) -(Note that Firefox v3 and up have a class-name of "Firefox" and "Navigator"; -lower versions use other classnames such as "Firefox-bin". Either choose the +(Note that Firefox v3 and up have a class-name of \"Firefox\" and \"Navigator\"; +lower versions use other classnames such as \"Firefox-bin\". Either choose the appropriate one, or cover your bases by using instead something like - @(className =? "Firefox" <||> className =? "Firefox-bin")@.) + @(className =? \"Firefox\" <||> className =? \"Firefox-bin\")@.) For detailed instructions on editing your key bindings, see "XMonad.Doc.Extending#Editing_key_bindings". -} --- | 'action' is an executable to be run via 'spawn' if the Window cannot be found. +-- | 'action' is an executable to be run via 'spawn' (of "XMonad.Core") if the Window cannot be found. -- Presumably this executable is the same one that you were looking for. runOrRaise :: String -> Query Bool -> X () runOrRaise action = raiseMaybe $ spawn action @@ -62,27 +62,27 @@ raise = raiseMaybe $ return () {- | 'raiseMaybe' queries all Windows based on a boolean provided by the user. Currently, there are three such useful booleans defined in - XMonad.ManageHook: title, resource, className. Each one tests based pretty + "XMonad.ManageHook": title, resource, className. Each one tests based pretty much as you would think. ManageHook also defines several operators, the most useful of which is (=?). So a useful test might be finding a Window whose - class is Firefox. Firefox declares the class "Firefox", so you'd want to - pass in a boolean like '(className =? "Firefox")'. + class is Firefox. Firefox 3 declares the class \"Firefox\", so you'd want to + pass in a boolean like @(className =? \"Firefox\")@. - If the boolean returns True on one or more windows, then XMonad will quickly - make visible the first result. If no Window meets the criteria, then the + If the boolean returns @True@ on one or more windows, then XMonad will quickly + make visible the first result. If no @Window@ meets the criteria, then the first argument comes into play. The first argument is an arbitrary IO function which will be executed if the - tests fail. This is what enables runOrRaise to use raiseMaybe: it simply runs + tests fail. This is what enables 'runOrRaise' to use 'raiseMaybe': it simply runs the desired program if it isn't found. But you don't have to do that. Maybe you want to do nothing if the search fails (the definition of 'raise'), or maybe you want to write to a log file, or call some prompt function, or something crazy like that. This hook gives you that flexibility. You can do some cute things with this hook. Suppose you want to do the same thing for Mutt which you just did for Firefox - but Mutt runs inside a terminal window? - No problem: you search for a terminal window calling itself 'mutt', and if + No problem: you search for a terminal window calling itself \"mutt\", and if there isn't you run a terminal with a command to run Mutt! Here's an example - (borrowing "XMonad.Utils.Run"'s 'runInTerm'): + (borrowing 'runInTerm' from "XMonad.Utils.Run"): > , ((modm, xK_m), raiseMaybe (runInTerm "-title mutt" "mutt") (title =? "mutt")) -} @@ -98,9 +98,9 @@ raiseMaybe f thatUserQuery = withWindowSet $ \s -> do raiseVar :: IO String -> X () raiseVar getvar = liftIO getvar >>= \var -> runOrRaise var (fmap (map toLower) className =? var) --- | 'raiseBrowser' and 'raiseEditor' grab $BROWSER and $EDITOR respectively and they either --- take you to the specified, or they try to run it. This is most useful if your variables are simple --- and look like 'firefox' or 'emacs'. +{- | 'raiseBrowser' and 'raiseEditor' grab $BROWSER and $EDITOR respectively and they either + take you to the specified program's window, or they try to run it. This is most useful + if your variables are simple and look like 'firefox' or 'emacs'. -} raiseBrowser, raiseEditor :: X () raiseBrowser = raiseVar getBrowser raiseEditor = raiseVar getEditor |