mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-05-19 11:30:22 -07:00
expose dzenWithArgs, dzenUrgencyHookWithArgs (for colors!)
This commit is contained in:
parent
5c9a9e68c4
commit
fd268ab7b9
12
Dzen.hs
12
Dzen.hs
@ -12,7 +12,9 @@
|
|||||||
--
|
--
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
|
|
||||||
module XMonadContrib.Dzen (dzen, dzenScreen, dzenUrgencyHook, seconds) where
|
module XMonadContrib.Dzen (dzen, dzenWithArgs, dzenScreen,
|
||||||
|
dzenUrgencyHook, dzenUrgencyHookWithArgs,
|
||||||
|
seconds) where
|
||||||
|
|
||||||
import Control.Monad (when)
|
import Control.Monad (when)
|
||||||
import Control.Monad.State (gets)
|
import Control.Monad.State (gets)
|
||||||
@ -44,14 +46,18 @@ dzenScreen sc str timeout = dzenWithArgs str ["-xs", screen] timeout
|
|||||||
-- XMonadContrib.UrgencyHook. Usage:
|
-- XMonadContrib.UrgencyHook. Usage:
|
||||||
-- > urgencyHook = dzenUrgencyHook (5 `seconds`)
|
-- > urgencyHook = dzenUrgencyHook (5 `seconds`)
|
||||||
dzenUrgencyHook :: Int -> Window -> X ()
|
dzenUrgencyHook :: Int -> Window -> X ()
|
||||||
dzenUrgencyHook duration w = do
|
dzenUrgencyHook = dzenUrgencyHookWithArgs []
|
||||||
|
|
||||||
|
dzenUrgencyHookWithArgs :: [String] -> Int -> Window -> X ()
|
||||||
|
dzenUrgencyHookWithArgs args duration w = do
|
||||||
visibles <- gets mapped
|
visibles <- gets mapped
|
||||||
name <- getName w
|
name <- getName w
|
||||||
ws <- gets windowset
|
ws <- gets windowset
|
||||||
whenJust (W.findTag w ws) (flash name visibles)
|
whenJust (W.findTag w ws) (flash name visibles)
|
||||||
where flash name visibles index =
|
where flash name visibles index =
|
||||||
when (not $ S.member w visibles) $
|
when (not $ S.member w visibles) $
|
||||||
dzen (show name ++ " requests your attention on workspace " ++ index) duration
|
dzenWithArgs (show name ++ " requests your attention on workspace " ++ index)
|
||||||
|
args duration
|
||||||
|
|
||||||
dzenWithArgs :: String -> [String] -> Int -> X ()
|
dzenWithArgs :: String -> [String] -> Int -> X ()
|
||||||
dzenWithArgs str args timeout = io $ runProcessWithInputAndWait "dzen2" args (unchomp str) timeout
|
dzenWithArgs str args timeout = io $ runProcessWithInputAndWait "dzen2" args (unchomp str) timeout
|
||||||
|
Loading…
x
Reference in New Issue
Block a user