diff options
author | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2013-06-05 00:23:32 +0200 |
---|---|---|
committer | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2013-06-05 00:23:32 +0200 |
commit | 85fdac20a36675559802dd215a81f640b91693fe (patch) | |
tree | 8fff8ccb15e611547f9501cd53fd569917769510 /src/Actions.hs | |
parent | 3d1fe35837bc756a96f8bf529455794bc1ac7d8b (diff) | |
download | xmobar-85fdac20a36675559802dd215a81f640b91693fe.tar.gz xmobar-85fdac20a36675559802dd215a81f640b91693fe.tar.bz2 |
Stripping actions in stdin and xprop plugins
Diffstat (limited to 'src/Actions.hs')
-rw-r--r-- | src/Actions.hs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/Actions.hs b/src/Actions.hs index cba027b..f3dc55a 100644 --- a/src/Actions.hs +++ b/src/Actions.hs @@ -10,13 +10,18 @@ -- ----------------------------------------------------------------------------- -module Actions where +module Actions (Action(..), runAction, stripActions) where import System.Process (system) import Control.Monad (void) +import Text.Regex (subRegex, mkRegex) data Action = Spawn String deriving (Eq) runAction :: Action -> IO () runAction (Spawn s) = void $ system (s ++ "&") + +stripActions :: String -> String +stripActions s = subRegex actionRegex s "[action=\1]\2[action]" + where actionRegex = mkRegex "<action=([^>])*>(.+?)</action>" |