aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDevin Mullins <me@twifkak.com>2007-11-03 03:17:05 +0100
committerDevin Mullins <me@twifkak.com>2007-11-03 03:17:05 +0100
commite31b1b338e0b0b97485270e9391276e545b4459c (patch)
treec9770fea1aed04d2f0b873752d798e422ebe1e9b
parenteba7c0ca10e67eae61630008946d69f7eb582623 (diff)
downloadXMonadContrib-e31b1b338e0b0b97485270e9391276e545b4459c.tar.gz
XMonadContrib-e31b1b338e0b0b97485270e9391276e545b4459c.tar.xz
XMonadContrib-e31b1b338e0b0b97485270e9391276e545b4459c.zip
add haddock for top-level Dzen bindings
darcs-hash:20071103021705-78224-46622e42710b1529e4d9a51aaa1775ba9743be50.gz
-rw-r--r--Dzen.hs24
1 files changed, 14 insertions, 10 deletions
diff --git a/Dzen.hs b/Dzen.hs
index 69729b2..911abbd 100644
--- a/Dzen.hs
+++ b/Dzen.hs
@@ -27,20 +27,28 @@ import XMonad
import XMonadContrib.NamedWindows (getName)
import XMonadContrib.Run (runProcessWithInputAndWait, seconds)
-toXineramaArg :: ScreenId -> String
-toXineramaArg n = show ( ((fromIntegral n)+1)::Int )
-
-- | @dzen str timeout@ pipes @str@ to dzen2 for @timeout@ microseconds.
-- Example usage:
-- > dzen "Hi, mom!" (5 `seconds`)
dzen :: String -> Int -> X ()
dzen str timeout = dzenWithArgs str [] timeout
+-- | @dzen str args timeout@ pipes @str@ to dzen2 for @timeout@ seconds, passing @args@ to dzen.
+-- Example usage:
+-- > dzen "Hi, dons!" ["-ta", "r"] (5 `seconds`)
+dzenWithArgs :: String -> [String] -> Int -> X ()
+dzenWithArgs str args timeout = io $ runProcessWithInputAndWait "dzen2" args (unchomp str) timeout
+ -- dzen seems to require the input to terminate with exactly one newline.
+ where unchomp s@['\n'] = s
+ unchomp [] = ['\n']
+ unchomp (c:cs) = c : unchomp cs
+
-- | @dzenScreen sc str timeout@ pipes @str@ to dzen2 for @timeout@ microseconds, and on screen @sc@.
-- Requires dzen to be compiled with Xinerama support.
dzenScreen :: ScreenId -> String -> Int -> X()
dzenScreen sc str timeout = dzenWithArgs str ["-xs", screen] timeout
where screen = toXineramaArg sc
+ toXineramaArg n = show ( ((fromIntegral n)+1)::Int )
-- | Flashes when a window requests your attention and you can't see it. For use with
-- XMonadContrib.UrgencyHook. Usage:
@@ -48,6 +56,9 @@ dzenScreen sc str timeout = dzenWithArgs str ["-xs", screen] timeout
dzenUrgencyHook :: Int -> Window -> X ()
dzenUrgencyHook = dzenUrgencyHookWithArgs []
+-- | Flashes when a window requests your attention and you can't see it. For use with
+-- XMonadContrib.UrgencyHook. Usage:
+-- > urgencyHook = dzenUrgencyHook ["-bg", "darkgreen"] (5 `seconds`)
dzenUrgencyHookWithArgs :: [String] -> Int -> Window -> X ()
dzenUrgencyHookWithArgs args duration w = do
visibles <- gets mapped
@@ -58,10 +69,3 @@ dzenUrgencyHookWithArgs args duration w = do
when (not $ S.member w visibles) $
dzenWithArgs (show name ++ " requests your attention on workspace " ++ index)
args duration
-
-dzenWithArgs :: String -> [String] -> Int -> X ()
-dzenWithArgs str args timeout = io $ runProcessWithInputAndWait "dzen2" args (unchomp str) timeout
- -- dzen seems to require the input to terminate with exactly one newline.
- where unchomp s@['\n'] = s
- unchomp [] = ['\n']
- unchomp (c:cs) = c : unchomp cs