xmonad-entryhelper-0.1.0.0: XMonad config entry point wrapper

Copyright(c) 2015 Javran Cheng
LicenseMIT
MaintainerJavran.C@gmail.com
Stabilityunstable
Portabilitynon-portable (requires X11)
Safe HaskellNone
LanguageHaskell2010

XMonad.Util.EntryHelper.Compile

Description

Compiling-related functions

Synopsis

Documentation

defaultCompile :: Bool -> IO ExitCode Source

the default compiling action. checks whether any of the sources files under "~/.xmonad/" is newer than the binary and recompiles XMonad if so.

defaultPostCompile :: ExitCode -> IO () Source

the default post-compiling action. prints out error log to stderr and pops up a message when the last compilation has failed.

compileUsingShell :: String -> IO ExitCode Source

compileUsingShell cmd spawns a new process to run a shell command (shell expansion is applied). The working directory of the shell command is "~/.xmonad/", and the process' stdout and stdout are redirected to "~/.xmonad/xmonad.errors"

withFileLock :: FilePath -> a -> IO a -> IO a Source

prevents an IO action from parallel execution by using a lock file. withFileLock fpath def action checks whether the file indicated by fpath exists. And:

  • returns def if the file exists.
  • creates fpath, executes the action, and deletes fpath when the action has completed. If action has failed, def will be returned instead.

Note that:

  • the action will be protected by safeIO, meaning the lock file will be deleted regardless of any error.
  • No check on fpath will be done by this function. Please make sure the lock file does not exist.
  • please prevent wrapping the action with same file lock multiple times, in which case the action will never be executed.

withLock :: a -> IO a -> IO a Source

withLock def action is the same as withFileLock fpath def action with fpath being "xmonad.${USERNAME}.lock" under your temporary directory. Wrapping an action with more than one withLock will not work.

See also: withFileLock, getTemporaryDirectory, getEffectiveUserName