From afc2d1ed565910b372f65eaf77ea90878ac3ab2b Mon Sep 17 00:00:00 2001 From: jao Date: Sat, 5 Feb 2022 02:49:22 +0000 Subject: swaybar-protocol: support for clickable Action --- src/Xmobar/Run/Actions.hs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/Xmobar/Run') 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 -- cgit v1.2.3