diff options
author | John Soo <jsoo1@asu.edu> | 2021-09-17 11:31:56 -0700 |
---|---|---|
committer | John Soo <jsoo1@asu.edu> | 2021-11-07 17:47:47 -0800 |
commit | b2d9ca5a587c62ee38d04766689f19d3d4a13c1b (patch) | |
tree | 2c42b65e83c6ecfbb70f475a2318239a8f2f841e /src/Xmobar/Config | |
parent | 397953f1c626a3a81b9ef7280d961fb3ce340c56 (diff) | |
download | xmobar-b2d9ca5a587c62ee38d04766689f19d3d4a13c1b.tar.gz xmobar-b2d9ca5a587c62ee38d04766689f19d3d4a13c1b.tar.bz2 |
Let xmobar be used with a signal TMVar when used from other haskell.
Diffstat (limited to 'src/Xmobar/Config')
-rw-r--r-- | src/Xmobar/Config/Parse.hs | 2 | ||||
-rw-r--r-- | src/Xmobar/Config/Types.hs | 13 |
2 files changed, 14 insertions, 1 deletions
diff --git a/src/Xmobar/Config/Parse.hs b/src/Xmobar/Config/Parse.hs index 056f3fc..48a31c3 100644 --- a/src/Xmobar/Config/Parse.hs +++ b/src/Xmobar/Config/Parse.hs @@ -57,7 +57,7 @@ parseConfig defaultConfig = x <- perms eof s <- getState - return (x,s) + return (x (SignalChan Nothing),s) perms = permute $ Config <$?> pFont <|?> pFontList <|?> pWmClass <|?> pWmName diff --git a/src/Xmobar/Config/Types.hs b/src/Xmobar/Config/Types.hs index c31e460..3cad31c 100644 --- a/src/Xmobar/Config/Types.hs +++ b/src/Xmobar/Config/Types.hs @@ -17,9 +17,12 @@ module Xmobar.Config.Types -- $config Config (..) , XPosition (..), Align (..), Border(..) + , SignalChan (..) ) where +import qualified Control.Concurrent.STM as STM import Xmobar.Run.Runnable (Runnable(..)) +import Xmobar.System.Signal (SignalType) -- $config -- Configuration data type @@ -65,6 +68,7 @@ data Config = -- right text alignment , template :: String -- ^ The output template , verbose :: Bool -- ^ Emit additional debug messages + , signal :: SignalChan -- ^ The signal channel used to send signals to xmobar } deriving (Read, Show) data XPosition = Top @@ -91,3 +95,12 @@ data Border = NoBorder | BottomBM Int | FullBM Int deriving ( Read, Show, Eq ) + +newtype SignalChan = SignalChan { unSignalChan :: Maybe (STM.TMVar SignalType) } + +instance Read SignalChan where + readsPrec _ s = [ (SignalChan Nothing, s) ] + +instance Show SignalChan where + show (SignalChan (Just _)) = "SignalChan (Just <tmvar>)" + show (SignalChan Nothing) = "SignalChan Nothing" |