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