mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-05-19 11:30:22 -07:00
improve WindowGo.hs Haddock formatting
This commit is contained in:
parent
7382e616a9
commit
e170cfc611
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user