ENH generalize device plugin
This commit is contained in:
parent
c394a65523
commit
f39762e1e8
|
@ -12,11 +12,11 @@ module Xmobar.Plugins.Device
|
||||||
)
|
)
|
||||||
where
|
where
|
||||||
|
|
||||||
import Control.Monad
|
|
||||||
import DBus
|
import DBus
|
||||||
import Data.Internal.DBus
|
import Data.Internal.DBus
|
||||||
import Data.Internal.Dependency
|
import Data.Internal.Dependency
|
||||||
import Data.Word
|
import Data.Word
|
||||||
|
import RIO
|
||||||
import qualified RIO.Text as T
|
import qualified RIO.Text as T
|
||||||
import XMonad.Internal.Command.Desktop
|
import XMonad.Internal.Command.Desktop
|
||||||
import XMonad.Internal.DBus.Common
|
import XMonad.Internal.DBus.Common
|
||||||
|
@ -45,7 +45,7 @@ devDep =
|
||||||
Endpoint networkManagerPkgs networkManagerBus nmPath nmInterface $
|
Endpoint networkManagerPkgs networkManagerBus nmPath nmInterface $
|
||||||
Method_ getByIP
|
Method_ getByIP
|
||||||
|
|
||||||
getDevice :: SysClient -> T.Text -> IO (Maybe ObjectPath)
|
getDevice :: MonadUnliftIO m => SysClient -> T.Text -> m (Maybe ObjectPath)
|
||||||
getDevice sys iface = bodyToMaybe <$> callMethod' sys mc
|
getDevice sys iface = bodyToMaybe <$> callMethod' sys mc
|
||||||
where
|
where
|
||||||
mc =
|
mc =
|
||||||
|
@ -53,7 +53,7 @@ getDevice sys iface = bodyToMaybe <$> callMethod' sys mc
|
||||||
{ methodCallBody = [toVariant iface]
|
{ methodCallBody = [toVariant iface]
|
||||||
}
|
}
|
||||||
|
|
||||||
getDeviceConnected :: ObjectPath -> SysClient -> IO [Variant]
|
getDeviceConnected :: MonadUnliftIO m => ObjectPath -> SysClient -> m [Variant]
|
||||||
getDeviceConnected path =
|
getDeviceConnected path =
|
||||||
callPropertyGet networkManagerBus path nmDeviceInterface $
|
callPropertyGet networkManagerBus path nmDeviceInterface $
|
||||||
memberName_ $
|
memberName_ $
|
||||||
|
|
Loading…
Reference in New Issue