diff options
author | Jochen Keil <jochen.keil@gmail.com> | 2012-08-08 20:02:43 +0200 |
---|---|---|
committer | Jochen Keil <jochen.keil@gmail.com> | 2012-08-09 10:45:45 +0200 |
commit | 536273a9d980cf3e71d8d05813e18b3ebcaf9233 (patch) | |
tree | de6ddba6644b62e749f751eee0940065f51c9b19 | |
parent | db34ddc05fd308986a1be4140f8f8ddf14598122 (diff) | |
download | xmobar-536273a9d980cf3e71d8d05813e18b3ebcaf9233.tar.gz xmobar-536273a9d980cf3e71d8d05813e18b3ebcaf9233.tar.bz2 |
Extend the interface so that plugins can send signals
Also: realign methods to look pretty again.
-rw-r--r-- | src/Commands.hs | 4 | ||||
-rw-r--r-- | src/Runnable.hs | 5 |
2 files changed, 7 insertions, 2 deletions
diff --git a/src/Commands.hs b/src/Commands.hs index 1bfbb94..f31c53c 100644 --- a/src/Commands.hs +++ b/src/Commands.hs @@ -30,6 +30,8 @@ import Data.Char import System.Process import System.Exit import System.IO (hClose) + +import Signal import XUtil class Show e => Exec e where @@ -42,6 +44,8 @@ class Show e => Exec e where start :: e -> (String -> IO ()) -> IO () start e cb = go where go = run e >>= cb >> tenthSeconds (rate e) >> go + trigger :: e -> (Maybe SignalType -> IO ()) -> IO () + trigger _ sh = sh Nothing data Command = Com Program Args Alias Rate deriving (Show,Read,Eq) diff --git a/src/Runnable.hs b/src/Runnable.hs index 56fedb3..84d9b77 100644 --- a/src/Runnable.hs +++ b/src/Runnable.hs @@ -29,8 +29,9 @@ import Commands data Runnable = forall r . (Exec r, Read r, Show r) => Run r instance Exec Runnable where - start (Run a) = start a - alias (Run a) = alias a + start (Run a) = start a + alias (Run a) = alias a + trigger (Run a) = trigger a instance Show Runnable where show (Run x) = show x |