REF clean up screensaver
This commit is contained in:
parent
f88db8d2a3
commit
31ef889762
|
@ -6,10 +6,7 @@ module XMonad.Internal.DBus.Screensaver
|
||||||
, callToggle
|
, callToggle
|
||||||
, callQuery
|
, callQuery
|
||||||
, matchSignal
|
, matchSignal
|
||||||
, ssPath
|
|
||||||
, ssDep
|
|
||||||
, ssSignalDep
|
, ssSignalDep
|
||||||
, SSControls(..)
|
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import Control.Monad (void)
|
import Control.Monad (void)
|
||||||
|
@ -33,13 +30,6 @@ type SSState = Bool -- true is enabled
|
||||||
ssExecutable :: String
|
ssExecutable :: String
|
||||||
ssExecutable = "xset"
|
ssExecutable = "xset"
|
||||||
|
|
||||||
ssDep :: Dependency
|
|
||||||
ssDep = Executable ssExecutable
|
|
||||||
|
|
||||||
ssSignalDep :: Dependency
|
|
||||||
ssSignalDep = DBusEndpoint xmonadBus $ Endpoint ssPath interface
|
|
||||||
$ Signal_ memState
|
|
||||||
|
|
||||||
toggle :: IO SSState
|
toggle :: IO SSState
|
||||||
toggle = do
|
toggle = do
|
||||||
st <- query
|
st <- query
|
||||||
|
@ -103,14 +93,12 @@ bodyGetCurrentState _ = Nothing
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
-- | Exported haskell API
|
-- | Exported haskell API
|
||||||
|
|
||||||
newtype SSControls = SSControls { ssToggle :: FeatureIO }
|
|
||||||
|
|
||||||
exportScreensaver :: Client -> FeatureIO
|
exportScreensaver :: Client -> FeatureIO
|
||||||
exportScreensaver client = Feature
|
exportScreensaver client = Feature
|
||||||
{ ftrAction = cmd
|
{ ftrAction = cmd
|
||||||
, ftrName = "screensaver interface"
|
, ftrName = "screensaver interface"
|
||||||
, ftrWarning = Default
|
, ftrWarning = Default
|
||||||
, ftrChildren = [ssDep, DBusBus xmonadBus]
|
, ftrChildren = [Executable ssExecutable, DBusBus xmonadBus]
|
||||||
}
|
}
|
||||||
where
|
where
|
||||||
cmd = export client ssPath defaultInterface
|
cmd = export client ssPath defaultInterface
|
||||||
|
@ -149,3 +137,7 @@ callQuery = do
|
||||||
|
|
||||||
matchSignal :: (Maybe SSState -> IO ()) -> IO SignalHandler
|
matchSignal :: (Maybe SSState -> IO ()) -> IO SignalHandler
|
||||||
matchSignal cb = addMatchCallback ruleCurrentState $ cb . bodyGetCurrentState
|
matchSignal cb = addMatchCallback ruleCurrentState $ cb . bodyGetCurrentState
|
||||||
|
|
||||||
|
ssSignalDep :: Dependency
|
||||||
|
ssSignalDep = DBusEndpoint xmonadBus $ Endpoint ssPath interface
|
||||||
|
$ Signal_ memState
|
||||||
|
|
Loading…
Reference in New Issue