ENH use exporter/unexporter for all interfaces
This commit is contained in:
parent
b2416153e6
commit
ac743daa32
|
@ -115,7 +115,10 @@ brightnessFileDep = pathR brightnessFile [Package AUR "tuxedo-keyboard"]
|
|||
clevoKeyboardSignalDep :: DBusDependency_ SesClient
|
||||
clevoKeyboardSignalDep = signalDep clevoKeyboardConfig
|
||||
|
||||
exportClevoKeyboard :: MonadUnliftIO m => Maybe SesClient -> Sometimes (m (), m ())
|
||||
exportClevoKeyboard
|
||||
:: (MonadReader env m, HasLogFunc env, MonadUnliftIO m)
|
||||
=> Maybe SesClient
|
||||
-> Sometimes (m (), m ())
|
||||
exportClevoKeyboard =
|
||||
brightnessExporter
|
||||
xpfClevoBacklight
|
||||
|
|
|
@ -101,7 +101,7 @@ matchSignal BrightnessConfig {bcPath = p, bcInterface = i} cb =
|
|||
-- Internal DBus Crap
|
||||
|
||||
brightnessExporter
|
||||
:: (MonadUnliftIO m, RealFrac b)
|
||||
:: (MonadReader env m, HasLogFunc env, MonadUnliftIO m, RealFrac b)
|
||||
=> XPQuery
|
||||
-> [Fulfillment]
|
||||
-> [IODependency_]
|
||||
|
@ -115,21 +115,23 @@ brightnessExporter q ful deps bc@BrightnessConfig {bcName = n} cl =
|
|||
tree = listToAnds (Bus ful xmonadBusName) $ fmap DBusIO deps
|
||||
|
||||
exportBrightnessControlsInner
|
||||
:: (MonadUnliftIO m, RealFrac b)
|
||||
:: (MonadReader env m, HasLogFunc env, MonadUnliftIO m, RealFrac b)
|
||||
=> BrightnessConfig a b
|
||||
-> SesClient
|
||||
-> (m (), m ())
|
||||
exportBrightnessControlsInner bc cl = (up, down)
|
||||
exportBrightnessControlsInner bc = cmd
|
||||
where
|
||||
up = liftIO $ do
|
||||
let ses = toClient cl
|
||||
maxval <- bcGetMax bc -- assume the max value will never change
|
||||
cmd = exportPair (bcPath bc) $ \cl_ -> do
|
||||
-- up = liftIO $ do
|
||||
-- let ses = toClient cl
|
||||
maxval <- liftIO $ bcGetMax bc -- assume the max value will never change
|
||||
let bounds = (bcMinRaw bc, maxval)
|
||||
let autoMethod' m f = autoMethod m $ emitBrightness bc ses =<< f bc bounds
|
||||
let autoMethod' m f = autoMethod m $ emitBrightness bc cl_ =<< f bc bounds
|
||||
let funget = bcGet bc
|
||||
export
|
||||
ses
|
||||
(bcPath bc)
|
||||
-- export
|
||||
-- ses
|
||||
-- (bcPath bc)
|
||||
return $
|
||||
defaultInterface
|
||||
{ interfaceName = bcInterface bc
|
||||
, interfaceMethods =
|
||||
|
@ -141,7 +143,7 @@ exportBrightnessControlsInner bc cl = (up, down)
|
|||
]
|
||||
, interfaceSignals = [sig]
|
||||
}
|
||||
down = liftIO $ unexport (toClient cl) (bcPath bc)
|
||||
-- down = liftIO $ unexport (toClient cl) (bcPath bc)
|
||||
sig =
|
||||
I.Signal
|
||||
{ I.signalName = memCur
|
||||
|
|
|
@ -99,7 +99,10 @@ maxFileDep = pathR maxFile []
|
|||
intelBacklightSignalDep :: DBusDependency_ SesClient
|
||||
intelBacklightSignalDep = signalDep intelBacklightConfig
|
||||
|
||||
exportIntelBacklight :: MonadUnliftIO m => Maybe SesClient -> Sometimes (m (), m ())
|
||||
exportIntelBacklight
|
||||
:: (MonadReader env m, HasLogFunc env, MonadUnliftIO m)
|
||||
=> Maybe SesClient
|
||||
-> Sometimes (m (), m ())
|
||||
exportIntelBacklight =
|
||||
brightnessExporter
|
||||
xpfIntelBacklight
|
||||
|
|
Loading…
Reference in New Issue