diff --git a/lib/Xmobar/Plugins/BacklightCommon.hs b/lib/Xmobar/Plugins/BacklightCommon.hs index f496fe3..2fd17b0 100644 --- a/lib/Xmobar/Plugins/BacklightCommon.hs +++ b/lib/Xmobar/Plugins/BacklightCommon.hs @@ -7,20 +7,21 @@ module Xmobar.Plugins.BacklightCommon (startBacklight) where import Data.Internal.DBus +import RIO import qualified RIO.Text as T import Xmobar.Plugins.Common startBacklight - :: RealFrac a - => ((Maybe a -> IO ()) -> SesClient -> IO ()) - -> (SesClient -> IO (Maybe a)) + :: (MonadUnliftIO m, RealFrac a) + => ((Maybe a -> m ()) -> SesClient -> m ()) + -> (SesClient -> m (Maybe a)) -> T.Text -> Callback - -> IO () + -> m () startBacklight matchSignal callGetBrightness icon cb = do withDBusClientConnection cb $ \c -> do - matchSignal display c - display =<< callGetBrightness c + matchSignal dpy c + dpy =<< callGetBrightness c where formatBrightness b = return $ T.concat [icon, T.pack $ show (round b :: Integer), "%"] - display = displayMaybe cb formatBrightness + dpy = displayMaybe cb formatBrightness