FIX increase threaddelay to avoid using cpu as space heater
This commit is contained in:
parent
90140fef5d
commit
ab73c24f75
|
@ -46,13 +46,10 @@ instance Exec Bluetooth where
|
||||||
reply <- callBT client
|
reply <- callBT client
|
||||||
-- TODO handle errors?
|
-- TODO handle errors?
|
||||||
case reply of
|
case reply of
|
||||||
Right ret -> cb
|
Right ret -> cb $ fmtState $ fromVariant =<< fromVariant
|
||||||
$ fmtState
|
|
||||||
$ fromVariant
|
|
||||||
=<< fromVariant
|
|
||||||
=<< listToMaybe (methodReturnBody ret)
|
=<< listToMaybe (methodReturnBody ret)
|
||||||
Left _ -> return ()
|
Left _ -> return ()
|
||||||
forever (threadDelay 5000)
|
forever (threadDelay 5000000)
|
||||||
where
|
where
|
||||||
-- Assume that the data in the PropertiesChanged signal has the form
|
-- Assume that the data in the PropertiesChanged signal has the form
|
||||||
-- [something, Map, something] where the Map in the middle has the
|
-- [something, Map, something] where the Map in the middle has the
|
||||||
|
@ -61,10 +58,8 @@ instance Exec Bluetooth where
|
||||||
getProps = \case
|
getProps = \case
|
||||||
[_, Variant (ValueMap TypeString TypeVariant m), _] -> Just m
|
[_, Variant (ValueMap TypeString TypeVariant m), _] -> Just m
|
||||||
_ -> Nothing
|
_ -> Nothing
|
||||||
lookupState m = fromVariant
|
lookupState m = fromVariant =<< fromValue
|
||||||
=<< fromValue
|
=<< M.lookup (AtomText "Powered") =<< m
|
||||||
=<< M.lookup (AtomText "Powered")
|
|
||||||
=<< m
|
|
||||||
fmtState = \case
|
fmtState = \case
|
||||||
Just s -> wrapColor text $ if s then colorOn else colorOff
|
Just s -> wrapColor text $ if s then colorOn else colorOff
|
||||||
Nothing -> "N/A"
|
Nothing -> "N/A"
|
||||||
|
|
|
@ -16,7 +16,7 @@ instance Exec IntelBacklight where
|
||||||
start (IntelBacklight icon) cb = do
|
start (IntelBacklight icon) cb = do
|
||||||
_ <- matchSignal $ cb . formatBrightness
|
_ <- matchSignal $ cb . formatBrightness
|
||||||
cb . formatBrightness =<< callGetBrightness
|
cb . formatBrightness =<< callGetBrightness
|
||||||
forever (threadDelay 5000)
|
forever (threadDelay 5000000)
|
||||||
where
|
where
|
||||||
formatBrightness = \case
|
formatBrightness = \case
|
||||||
Just b -> icon ++ show (b `div` 100) ++ "%"
|
Just b -> icon ++ show (b `div` 100) ++ "%"
|
||||||
|
|
|
@ -17,7 +17,7 @@ instance Exec Screensaver where
|
||||||
start (Screensaver (text, colorOn, colorOff)) cb = do
|
start (Screensaver (text, colorOn, colorOff)) cb = do
|
||||||
_ <- matchSignal $ cb . fmtState
|
_ <- matchSignal $ cb . fmtState
|
||||||
cb . fmtState =<< callQuery
|
cb . fmtState =<< callQuery
|
||||||
forever (threadDelay 5000)
|
forever (threadDelay 5000000)
|
||||||
where
|
where
|
||||||
fmtState = \case
|
fmtState = \case
|
||||||
Just s -> wrapColor text $ if s then colorOn else colorOff
|
Just s -> wrapColor text $ if s then colorOn else colorOff
|
||||||
|
|
Loading…
Reference in New Issue