module XMonad.Hooks.CustomRestart
( CustomRestart (..)
, customRestartEventHook
) where
import Control.Monad (when)
import Data.Monoid
import XMonad
data CustomRestart = CustomRestart deriving ( Show, Read )
customRestartEventHook :: String -> Event -> X All
customRestartEventHook prog (ClientMessageEvent {ev_message_type = mt}) = do
d <- asks display
a <- io $ internAtom d "XMONAD_CUSTOM_RESTART" False
when (mt == a) $ do
restart prog True
return (All True)
customRestartEventHook _ _ = return (All True)