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 :: DBusDependency_ SesClient
|
||||||
clevoKeyboardSignalDep = signalDep clevoKeyboardConfig
|
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 =
|
exportClevoKeyboard =
|
||||||
brightnessExporter
|
brightnessExporter
|
||||||
xpfClevoBacklight
|
xpfClevoBacklight
|
||||||
|
|
|
@ -101,7 +101,7 @@ matchSignal BrightnessConfig {bcPath = p, bcInterface = i} cb =
|
||||||
-- Internal DBus Crap
|
-- Internal DBus Crap
|
||||||
|
|
||||||
brightnessExporter
|
brightnessExporter
|
||||||
:: (MonadUnliftIO m, RealFrac b)
|
:: (MonadReader env m, HasLogFunc env, MonadUnliftIO m, RealFrac b)
|
||||||
=> XPQuery
|
=> XPQuery
|
||||||
-> [Fulfillment]
|
-> [Fulfillment]
|
||||||
-> [IODependency_]
|
-> [IODependency_]
|
||||||
|
@ -115,21 +115,23 @@ brightnessExporter q ful deps bc@BrightnessConfig {bcName = n} cl =
|
||||||
tree = listToAnds (Bus ful xmonadBusName) $ fmap DBusIO deps
|
tree = listToAnds (Bus ful xmonadBusName) $ fmap DBusIO deps
|
||||||
|
|
||||||
exportBrightnessControlsInner
|
exportBrightnessControlsInner
|
||||||
:: (MonadUnliftIO m, RealFrac b)
|
:: (MonadReader env m, HasLogFunc env, MonadUnliftIO m, RealFrac b)
|
||||||
=> BrightnessConfig a b
|
=> BrightnessConfig a b
|
||||||
-> SesClient
|
-> SesClient
|
||||||
-> (m (), m ())
|
-> (m (), m ())
|
||||||
exportBrightnessControlsInner bc cl = (up, down)
|
exportBrightnessControlsInner bc = cmd
|
||||||
where
|
where
|
||||||
up = liftIO $ do
|
cmd = exportPair (bcPath bc) $ \cl_ -> do
|
||||||
let ses = toClient cl
|
-- up = liftIO $ do
|
||||||
maxval <- bcGetMax bc -- assume the max value will never change
|
-- let ses = toClient cl
|
||||||
|
maxval <- liftIO $ bcGetMax bc -- assume the max value will never change
|
||||||
let bounds = (bcMinRaw bc, maxval)
|
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
|
let funget = bcGet bc
|
||||||
export
|
-- export
|
||||||
ses
|
-- ses
|
||||||
(bcPath bc)
|
-- (bcPath bc)
|
||||||
|
return $
|
||||||
defaultInterface
|
defaultInterface
|
||||||
{ interfaceName = bcInterface bc
|
{ interfaceName = bcInterface bc
|
||||||
, interfaceMethods =
|
, interfaceMethods =
|
||||||
|
@ -141,7 +143,7 @@ exportBrightnessControlsInner bc cl = (up, down)
|
||||||
]
|
]
|
||||||
, interfaceSignals = [sig]
|
, interfaceSignals = [sig]
|
||||||
}
|
}
|
||||||
down = liftIO $ unexport (toClient cl) (bcPath bc)
|
-- down = liftIO $ unexport (toClient cl) (bcPath bc)
|
||||||
sig =
|
sig =
|
||||||
I.Signal
|
I.Signal
|
||||||
{ I.signalName = memCur
|
{ I.signalName = memCur
|
||||||
|
|
|
@ -99,7 +99,10 @@ maxFileDep = pathR maxFile []
|
||||||
intelBacklightSignalDep :: DBusDependency_ SesClient
|
intelBacklightSignalDep :: DBusDependency_ SesClient
|
||||||
intelBacklightSignalDep = signalDep intelBacklightConfig
|
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 =
|
exportIntelBacklight =
|
||||||
brightnessExporter
|
brightnessExporter
|
||||||
xpfIntelBacklight
|
xpfIntelBacklight
|
||||||
|
|
Loading…
Reference in New Issue