REF clean up
This commit is contained in:
parent
9961f2909d
commit
c2923a7379
|
@ -90,18 +90,8 @@ listenACPI = do
|
||||||
acpiPath :: FilePath
|
acpiPath :: FilePath
|
||||||
acpiPath = "/var/run/acpid.socket"
|
acpiPath = "/var/run/acpid.socket"
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
socketDep :: Tree_ IODependency_
|
||||||
-- | Exported API
|
socketDep = Only_ $ pathR acpiPath
|
||||||
|
|
||||||
-- | Spawn a new thread that will listen for ACPI events on the acpid socket
|
|
||||||
-- and send ClientMessage events when it receives them
|
|
||||||
runPowermon :: SometimesIO
|
|
||||||
runPowermon = sometimesIO "ACPI event monitor" (Only_ $ pathR acpiPath) listenACPI
|
|
||||||
|
|
||||||
runHandleACPI :: Always (String -> X ())
|
|
||||||
runHandleACPI = always1 "ACPI event handler" withLock $ handleACPI skip
|
|
||||||
where
|
|
||||||
withLock = IORoot handleACPI (Only $ IOSometimes runScreenLock id)
|
|
||||||
|
|
||||||
-- | Handle ClientMessage event containing and ACPI event (to be used in
|
-- | Handle ClientMessage event containing and ACPI event (to be used in
|
||||||
-- Xmonad's event hook)
|
-- Xmonad's event hook)
|
||||||
|
@ -117,3 +107,15 @@ handleACPI lock tag = do
|
||||||
forM_ status $ flip when runSuspend
|
forM_ status $ flip when runSuspend
|
||||||
lock
|
lock
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
-- | Exported API
|
||||||
|
|
||||||
|
-- | Spawn a new thread that will listen for ACPI events on the acpid socket
|
||||||
|
-- and send ClientMessage events when it receives them
|
||||||
|
runPowermon :: SometimesIO
|
||||||
|
runPowermon = sometimesIO "ACPI event monitor" socketDep listenACPI
|
||||||
|
|
||||||
|
runHandleACPI :: Always (String -> X ())
|
||||||
|
runHandleACPI = always1 "ACPI event handler" withLock $ handleACPI skip
|
||||||
|
where
|
||||||
|
withLock = IORoot handleACPI (Only $ IOSometimes runScreenLock id)
|
||||||
|
|
Loading…
Reference in New Issue