diff --git a/CHANGES.md b/CHANGES.md index e06e66b..9d4689c 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -29,6 +29,10 @@ In the cases of 1. and 3., the build script or executable is expected to be in the config dir. + Additionally, the xmonad config binary and intermediate object files were + moved to the cache directory (only relevant if using XDG or + `XMONAD_CACHE_DIR`). + * Change `ScreenDetail` to a newtype and make `RationalRect` strict in its contents. diff --git a/INSTALL.md b/INSTALL.md index 83e8c6b..a8dac86 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -356,13 +356,13 @@ exec xmonad in your `~/.xinitrc`, you would write ``` shell -exec $HOME/.local/share/xmonad/xmonad-x86_64-linux +exec $HOME/.cache/xmonad/xmonad-x86_64-linux ``` -The `~/.local/share` prefix is the `$XDG_DATA_DIR` directory. Note that +The `~/.cache` prefix is the `$XDG_CACHE_HOME` directory. Note that if your xmonad configuration resides within `~/.xmonad`, then the executable will also be within that directory and not in -`$XDG_DATA_DIR`. +`$XDG_CACHE_HOME`. [XDG]: https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html [git]: https://git-scm.com/ diff --git a/src/XMonad/Core.hs b/src/XMonad/Core.hs index 08b3dce..86f0a1a 100644 --- a/src/XMonad/Core.hs +++ b/src/XMonad/Core.hs @@ -480,8 +480,7 @@ runOnWorkspaces job = do -- the following purposes: -- -- * @dataDir@: This directory is used by XMonad to store data files --- such as the run-time state file and the configuration binary --- generated by GHC. +-- such as the run-time state file. -- -- * @cfgDir@: This directory is where user configuration files are -- stored (e.g, the xmonad.hs file). You may also create a @lib@ @@ -489,7 +488,9 @@ runOnWorkspaces job = do -- command will add it to the GHC include path. -- -- * @cacheDir@: This directory is used to store temporary files that --- can easily be recreated. For example, the XPrompt history file. +-- can easily be recreated such as the configuration binary and any +-- intermediate object files generated by GHC. +-- Also, the XPrompt history file goes here. -- -- For how these directories are chosen, see 'getDirectories'. -- @@ -565,12 +566,17 @@ getXMonadDataDir :: X String getXMonadDataDir = asks (dataDir . directories) {-# DEPRECATED getXMonadDataDir "Use `asks (dataDir . directories)' instead." #-} -binFileName, errFileName, stateFileName, srcFileName, libFileName :: Directories -> FilePath -binFileName Directories{ dataDir } = dataDir "xmonad-" <> arch <> "-" <> os +binFileName, buildDirName :: Directories -> FilePath +binFileName Directories{ cacheDir } = cacheDir "xmonad-" <> arch <> "-" <> os +buildDirName Directories{ cacheDir } = cacheDir "build-" <> arch <> "-" <> os + +errFileName, stateFileName :: Directories -> FilePath errFileName Directories{ dataDir } = dataDir "xmonad.errors" stateFileName Directories{ dataDir } = dataDir "xmonad.state" -srcFileName Directories{ cfgDir } = cfgDir "xmonad.hs" -libFileName Directories{ cfgDir } = cfgDir "lib" + +srcFileName, libFileName :: Directories -> FilePath +srcFileName Directories{ cfgDir } = cfgDir "xmonad.hs" +libFileName Directories{ cfgDir } = cfgDir "lib" buildScriptFileName, stackYamlFileName :: Directories -> FilePath buildScriptFileName Directories{ cfgDir } = cfgDir "build" @@ -664,6 +670,7 @@ compile dirs method = , "-fforce-recomp" , "-main-is", "main" , "-v0" + , "-outputdir", buildDirName dirs , "-o", binFileName dirs ]