[xmonad] Not running my startupHook on restart

Daniel Wagner dmwit at dmwit.com
Mon Jan 4 02:46:56 UTC 2016


On Thu, Dec 31, 2015 at 8:35 AM, Adam Sjøgren <asjo at koldfront.dk> wrote:

> And then I have changed the restart keybinding like this:
>
>         , ("M-S-r", spawn "xmonad --recompile; export NO_STARTUP_HOOK=1;
> xmonad --restart")
>
> Unfortunately it doesn't work - I guess something "more" is going on


To explain the "something more", `xmonad --restart` doesn't do what you
think it does. Namely: it just sets a property on the root window and dies;
the new xmonad process does *not* start managing windows. Instead, the
existing xmonad process notices the property change on the root window and
restarts *itself*, passing along its current internal state in command-line
parameters. This is why the environment change is not absorbed: only the
process that sets a root window property and exits sees the new
environment; the existing process' environment, which is the one inherited
by the new window manager, is unchanged. You should be able to fix this by
setting the environment in-process with System.Environment.setEnv and then
directly calling XMonad.Operations.restart (why go through a complicated
rigamarole to send yourself a message when you can just pretend you already
got it? ;-). Something like this:

    , ("M-S-r", setEnv "NO_STARTUP_HOOK" "1" >> restart "xmonad" True)

~d
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/xmonad/attachments/20160103/9f87a48b/attachment.html>


More information about the xmonad mailing list