ENH generalize brightness controls
This commit is contained in:
parent
8eb97f3eec
commit
524818decf
|
@ -867,7 +867,7 @@ externalBindings runIO cleanup db =
|
|||
where
|
||||
ses = dbSesClient db
|
||||
sys = dbSysClient db
|
||||
brightessControls ctl getter = (getter . ctl) ses
|
||||
brightessControls ctl getter = (fmap (liftIO . runIO) . getter . ctl) ses
|
||||
ib = Left . brightessControls intelBacklightControls
|
||||
ck = Left . brightessControls clevoKeyboardControls
|
||||
ftrAlways n = Right . Always n . Always_ . FallbackAlone
|
||||
|
|
|
@ -126,7 +126,7 @@ exportClevoKeyboard =
|
|||
[stateFileDep, brightnessFileDep]
|
||||
clevoKeyboardConfig
|
||||
|
||||
clevoKeyboardControls :: Maybe SesClient -> BrightnessControls
|
||||
clevoKeyboardControls :: MonadUnliftIO m => Maybe SesClient -> BrightnessControls m
|
||||
clevoKeyboardControls = brightnessControls xpfClevoBacklight clevoKeyboardConfig
|
||||
|
||||
callGetBrightnessCK :: MonadUnliftIO m => SesClient -> m (Maybe Brightness)
|
||||
|
|
|
@ -45,18 +45,19 @@ data BrightnessConfig a b = BrightnessConfig
|
|||
, bcName :: T.Text
|
||||
}
|
||||
|
||||
data BrightnessControls = BrightnessControls
|
||||
{ bctlMax :: SometimesX
|
||||
, bctlMin :: SometimesX
|
||||
, bctlInc :: SometimesX
|
||||
, bctlDec :: SometimesX
|
||||
data BrightnessControls m = BrightnessControls
|
||||
{ bctlMax :: Sometimes (m ())
|
||||
, bctlMin :: Sometimes (m ())
|
||||
, bctlInc :: Sometimes (m ())
|
||||
, bctlDec :: Sometimes (m ())
|
||||
}
|
||||
|
||||
brightnessControls
|
||||
:: XPQuery
|
||||
:: MonadUnliftIO m
|
||||
=> XPQuery
|
||||
-> BrightnessConfig a b
|
||||
-> Maybe SesClient
|
||||
-> BrightnessControls
|
||||
-> BrightnessControls m
|
||||
brightnessControls q bc cl =
|
||||
BrightnessControls
|
||||
{ bctlMax = cb "max brightness" memMax
|
||||
|
@ -167,12 +168,13 @@ emitBrightness BrightnessConfig {bcPath = p, bcInterface = i} client cur =
|
|||
sig = signal p i memCur
|
||||
|
||||
callBacklight
|
||||
:: XPQuery
|
||||
:: MonadUnliftIO m
|
||||
=> XPQuery
|
||||
-> Maybe SesClient
|
||||
-> BrightnessConfig a b
|
||||
-> T.Text
|
||||
-> MemberName
|
||||
-> SometimesX
|
||||
-> Sometimes (m ())
|
||||
callBacklight
|
||||
q
|
||||
cl
|
||||
|
|
|
@ -110,7 +110,7 @@ exportIntelBacklight =
|
|||
[curFileDep, maxFileDep]
|
||||
intelBacklightConfig
|
||||
|
||||
intelBacklightControls :: Maybe SesClient -> BrightnessControls
|
||||
intelBacklightControls :: MonadUnliftIO m => Maybe SesClient -> BrightnessControls m
|
||||
intelBacklightControls = brightnessControls xpfIntelBacklight intelBacklightConfig
|
||||
|
||||
callGetBrightnessIB :: MonadUnliftIO m => SesClient -> m (Maybe Brightness)
|
||||
|
|
Loading…
Reference in New Issue