aboutsummaryrefslogtreecommitdiffstats
path: root/XMonad/Hooks/UrgencyHook.hs
diff options
context:
space:
mode:
authorgopsychonauts <gopsychonauts@gmail.com>2012-05-04 08:23:39 +0200
committergopsychonauts <gopsychonauts@gmail.com>2012-05-04 08:23:39 +0200
commitc73e5ad6d402a847c67b55bf4a3553841a71bf63 (patch)
treeda888ea8ce153d9cf3125637228946ddf240c764 /XMonad/Hooks/UrgencyHook.hs
parentf5d1ccf4433fb9aedda99a02a0cf5192f0a5deac (diff)
downloadXMonadContrib-c73e5ad6d402a847c67b55bf4a3553841a71bf63.tar.gz
XMonadContrib-c73e5ad6d402a847c67b55bf4a3553841a71bf63.tar.xz
XMonadContrib-c73e5ad6d402a847c67b55bf4a3553841a71bf63.zip
UrgencyHooks made available as Window -> X () functions
Ignore-this: 6a57cae1d693109b7e27c6471d04f50f Adds an UrgencyHook instance for the type Window -> X (), allowing any such functions to be used directly as UrgencyHooks. The Show and Read constraints were removed from the UrgencyHook class in order to permit this; these constraints were required only in a historical implementation of the module, which used a layout modifier. All existing configurations using UrgencyHooks should remain fully functional. New configs may make use of this modification by declaring their UrgencyHook as a simple Window -> X () function. darcs-hash:20120504062339-1e6bb-c452c421b9598394f422d90e4875aa7f834bf62f.gz
Diffstat (limited to 'XMonad/Hooks/UrgencyHook.hs')
-rw-r--r--XMonad/Hooks/UrgencyHook.hs11
1 files changed, 10 insertions, 1 deletions
diff --git a/XMonad/Hooks/UrgencyHook.hs b/XMonad/Hooks/UrgencyHook.hs
index 4ecfca3..495c576 100644
--- a/XMonad/Hooks/UrgencyHook.hs
+++ b/XMonad/Hooks/UrgencyHook.hs
@@ -68,6 +68,7 @@ module XMonad.Hooks.UrgencyHook (
SpawnUrgencyHook(..),
UrgencyHook(urgencyHook),
Interval,
+ borderUrgencyHook, focusHook, spawnUrgencyHook, stdoutUrgencyHook
) where
import XMonad
@@ -390,9 +391,12 @@ suppressibleWindows Never = return []
-- | The class definition, and some pre-defined instances.
-class (Read h, Show h) => UrgencyHook h where
+class UrgencyHook h where
urgencyHook :: h -> Window -> X ()
+instance UrgencyHook (Window -> X ()) where
+ urgencyHook = id
+
data NoUrgencyHook = NoUrgencyHook deriving (Read, Show)
instance UrgencyHook NoUrgencyHook where
@@ -420,6 +424,7 @@ instance UrgencyHook DzenUrgencyHook where
> withUrgencyHook FocusHook $ myconfig { ...
-}
+focusHook = urgencyHook FocusHook
data FocusHook = FocusHook deriving (Read, Show)
instance UrgencyHook FocusHook where
@@ -435,6 +440,8 @@ instance UrgencyHook FocusHook where
-- (This should be @urgentBorderColor@ but that breaks "XMonad.Layout.Decoration".
-- @borderColor@ breaks anyone using 'XPConfig' from "XMonad.Prompt". We need to
-- think a bit more about namespacing issues, maybe.)
+
+borderUrgencyHook = urgencyHook . BorderUrgencyHook
data BorderUrgencyHook = BorderUrgencyHook { urgencyBorderColor :: !String }
deriving (Read, Show)
@@ -458,12 +465,14 @@ dzenUrgencyHook = DzenUrgencyHook { duration = seconds 5, args = [] }
-- | Spawn a commandline thing, appending the window id to the prefix string
-- you provide. (Make sure to add a space if you need it.) Do your crazy
-- xcompmgr thing.
+spawnUrgencyHook = urgencyHook . SpawnUrgencyHook
newtype SpawnUrgencyHook = SpawnUrgencyHook String deriving (Read, Show)
instance UrgencyHook SpawnUrgencyHook where
urgencyHook (SpawnUrgencyHook prefix) w = spawn $ prefix ++ show w
-- | For debugging purposes, really.
+stdoutUrgencyHook = urgencyHook StdoutUrgencyHook
data StdoutUrgencyHook = StdoutUrgencyHook deriving (Read, Show)
instance UrgencyHook StdoutUrgencyHook where