xmonad-contrib-0.11.2: Third party extensions for xmonad

Portability | unportable
Stability | unstable
Maintainer | Adam Vogt <vogt.adam@gmail.com>
Safe Haskell | None

XMonad.Util.Replace

Contents

- Usage
- Notes
  - Implementing a `--replace` flag

Description

Implements a `--replace` behavior outside of core.

Synopsis

- replace :: IO ()

# Usage

You must run the `replace` action before starting xmonad proper, this results in xmonad replacing the currently running WM regardless of the arguments it is run with:

     import XMonad
     import XMonad.Util.Replace
     main = do
        replace
        xmonad $ defaultConfig { .... }

replace :: IO ()Source

`replace` must be run before xmonad starts to signals to compliant window managers that they must exit and let xmonad take over.

# Notes

This doesn't seem to work for replacing WMs that have been started from within xmonad, such as with ``restart` openbox False`, but no other WMs that implements --replace manage this either. `replace` works for replacing metacity when the full gnome-session is started at least.

## Implementing a `--replace` flag

You can use `getArgs` to watch for an explicit `--replace` flag:

     import XMonad
     import XMonad.Util.Replace (replace)
     import Control.Monad (when)
     import System.Environment (getArgs)

     main = do
        args <- getArgs
        when ("--replace" `elem` args) replace
        xmonad $ defaultConfig { .... }

Note that your `~/.xmonad/xmonad-$arch-$os` binary is not run with the same flags as the `xmonad` binary that calls it. You may be able to work around this by running your `~/.xmonad/xmonad-$arch-$os` binary directly, which is otherwise not recommended.