diff options
Diffstat (limited to 'src/Xmobar/App')
-rw-r--r-- | src/Xmobar/App/Config.hs | 1 | ||||
-rw-r--r-- | src/Xmobar/App/EventLoop.hs | 2 | ||||
-rw-r--r-- | src/Xmobar/App/Main.hs | 6 |
3 files changed, 7 insertions, 2 deletions
diff --git a/src/Xmobar/App/Config.hs b/src/Xmobar/App/Config.hs index d17577e..a227681 100644 --- a/src/Xmobar/App/Config.hs +++ b/src/Xmobar/App/Config.hs @@ -64,6 +64,7 @@ defaultConfig = , template = "%StdinReader% }{ " ++ "<fc=#00FF00>%uname%</fc> * <fc=#FF0000>%theDate%</fc>" , verbose = False + , signal = SignalChan Nothing } -- | Return the path to the xmobar data directory. This directory is diff --git a/src/Xmobar/App/EventLoop.hs b/src/Xmobar/App/EventLoop.hs index 474ff4f..ae68e96 100644 --- a/src/Xmobar/App/EventLoop.hs +++ b/src/Xmobar/App/EventLoop.hs @@ -42,7 +42,7 @@ import Data.Maybe (fromJust, isJust) import qualified Data.List.NonEmpty as NE import Xmobar.System.Signal -import Xmobar.Config.Types +import Xmobar.Config.Types (persistent, position, iconRoot, Config, Align(..), XPosition(..)) import Xmobar.Run.Exec import Xmobar.Run.Runnable import Xmobar.X11.Actions diff --git a/src/Xmobar/App/Main.hs b/src/Xmobar/App/Main.hs index 61604e0..002ff27 100644 --- a/src/Xmobar/App/Main.hs +++ b/src/Xmobar/App/Main.hs @@ -18,12 +18,14 @@ module Xmobar.App.Main (xmobar, xmobarMain, configFromArgs) where import Control.Concurrent.Async (Async, cancel) +import Control.Concurrent.STM (TMVar, newEmptyTMVarIO) import Control.Exception (bracket) import Control.Monad (unless) import Data.Foldable (for_) import qualified Data.Map as Map import Data.List (intercalate) +import Data.Maybe (isJust) import System.Posix.Process (executeFile) import System.Environment (getArgs) import System.FilePath ((</>), takeBaseName, takeDirectory, takeExtension) @@ -53,7 +55,9 @@ xmobar conf = withDeferSignals $ do fl <- mapM (initFont d) (additionalFonts conf) cls <- mapM (parseTemplate (commands conf) (sepChar conf)) (splitTemplate (alignSep conf) (template conf)) - sig <- setupSignalHandler + let confSig = unSignalChan (signal conf) + sig <- maybe newEmptyTMVarIO pure confSig + unless (isJust confSig) $ setupSignalHandler sig refLock <- newRefreshLock withTimer (refreshLock refLock) $ bracket (mapM (mapM $ startCommand sig) cls) |