summaryrefslogtreecommitdiffhomepage
path: root/src/Xmobar/Config/Types.hs
diff options
context:
space:
mode:
authorJohn Soo <jsoo1@asu.edu>2021-09-17 11:31:56 -0700
committerJohn Soo <jsoo1@asu.edu>2021-11-07 17:47:47 -0800
commitb2d9ca5a587c62ee38d04766689f19d3d4a13c1b (patch)
tree2c42b65e83c6ecfbb70f475a2318239a8f2f841e /src/Xmobar/Config/Types.hs
parent397953f1c626a3a81b9ef7280d961fb3ce340c56 (diff)
downloadxmobar-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/Types.hs')
-rw-r--r--src/Xmobar/Config/Types.hs13
1 files changed, 13 insertions, 0 deletions
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"