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