[xmonad] Shutdown hook
dons at galois.com
Sat Feb 13 18:55:39 EST 2010
> There is a startupHook in XConfig. I'm missing shutdownHook however. Is
> there any proper way to execute custom code when xmonad is about to exit?
xmonad exits by throwing an asynchronous exception from the inner loop
out to main. The runtime catches this an exits gracefully.
You can write your own shutdown hook by catching this exception in your
config main, and running your hook, before rethrowing.
I bet someone's already done this, and wrapped it up nicely, otherwise,
look at Control.Exception in the Haskell base library for how to use the
main = handle xmonad shutdown
shutdown e = do
... my action ...
More information about the xmonad