summaryrefslogtreecommitdiffhomepage
path: root/src/Xmobar/Run
diff options
context:
space:
mode:
Diffstat (limited to 'src/Xmobar/Run')
-rw-r--r--src/Xmobar/Run/Actions.hs13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/Xmobar/Run/Actions.hs b/src/Xmobar/Run/Actions.hs
index f7d0e45..2a49312 100644
--- a/src/Xmobar/Run/Actions.hs
+++ b/src/Xmobar/Run/Actions.hs
@@ -10,7 +10,11 @@
--
-----------------------------------------------------------------------------
-module Xmobar.Run.Actions (Button, Action(..), runAction, stripActions) where
+module Xmobar.Run.Actions ( Button
+ , Action(..)
+ , runAction
+ , runAction'
+ , stripActions) where
import System.Process (system)
import Control.Monad (void)
@@ -19,12 +23,15 @@ import Data.Word (Word32)
type Button = Word32
-data Action = Spawn [Button] String
- deriving (Eq, Show)
+data Action = Spawn [Button] String deriving (Eq, Read, Show)
runAction :: Action -> IO ()
runAction (Spawn _ s) = void $ system (s ++ "&")
+-- | Run action with stdout redirected to stderr
+runAction' :: Action -> IO ()
+runAction' (Spawn _ s) = void $ system (s ++ " 1>&2 &")
+
stripActions :: String -> String
stripActions s = case matchRegex actionRegex s of
Nothing -> s