From d52278f48d98f116d3a1ebd21000bf80d90b8c9d Mon Sep 17 00:00:00 2001 From: Jochen Keil Date: Wed, 22 Aug 2012 17:29:37 +0200 Subject: Allow multiple signals over dbus at once It's easy to implement, since arguments to dbus method calls are handed over as list anyway. It also removes the need for safeHead. Bottom line: extra functionality without extra cost. --- src/IPC/DBus.hs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/IPC/DBus.hs b/src/IPC/DBus.hs index 469a7c6..d755220 100644 --- a/src/IPC/DBus.hs +++ b/src/IPC/DBus.hs @@ -18,13 +18,12 @@ import Prelude hiding (catch) import DBus import DBus.Client -import Control.Monad (join, when) +import Control.Monad (when) import Control.Concurrent import Control.Exception (catch) import System.IO (stderr, hPutStrLn) import Signal -import Plugins.Utils (safeHead) busName :: BusName busName = busName_ "org.Xmobar.Control" @@ -56,8 +55,8 @@ sendSignalMethod mvst = method interfaceName sendSignalName sendSignalMethodCall :: MethodCall -> IO Reply sendSignalMethodCall mc = do - when ( methodCallMember mc == sendSignalName ) $ sendSignal $ - join $ safeHead $ map fromVariant $ methodCallBody mc + when ( methodCallMember mc == sendSignalName ) + $ mapM_ (sendSignal . fromVariant) (methodCallBody mc) return ( replyReturn [] ) sendSignal :: Maybe SignalType -> IO () -- cgit v1.2.3