From e1c555e3e696e9e88439373cfc8132226d172320 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Tue, 3 Jan 2017 15:46:07 -0700 Subject: [PATCH] Implement recommendations from Brent's review --- CHANGES.md | 20 ++++++++++++++------ src/XMonad/Core.hs | 24 ++++++++++++++++++------ src/XMonad/Main.hs | 3 ++- src/XMonad/Operations.hs | 2 +- 4 files changed, 35 insertions(+), 14 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 684465b..30db61a 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -35,10 +35,16 @@ 3. The `~/.xmonad` directory. - If none of these directories exist then (1) will be used if it is - set, otherwise (2) will be used. Of course, if neither (1) nor - (2) exist but (3) does then (3) will be used just like previous - versions of xmonad. + If none of these directories exist then an appropriate directory + will be created. If the relevant environment variable mentioned + in step (1) above is set, the referent directory will be created + and used. Otherwise the relevant XDG directory from (2) will be + used. + + Note: If the environment variables mentioned in (1) above are not + set, the directories in (2) don't exist, and `~/.xmonad` does + exist, the traditional behavior of using `~/.xmonad` for + everything will be used. This fixes a few issues, notably #7 and #56. @@ -53,7 +59,8 @@ need to have newer time stamps than the generated executable in order for the build script to be called. - This is one possible fix for issue #8. + This fixes #8. (One of two possible custom build solutions. See + the next entry for another solution.) * For users who build their xmonad configuration using tools such as cabal or stack, there is another option for executing xmonad. @@ -70,7 +77,8 @@ See the documentation for the `launch` function in `XMonad.Main` for more details. - This is another possible solution to issue #8. + Fixes #8. (Second way to have a custom build environment for + XMonad. See previous entry for another solution.) ## 0.12 (December 14, 2015) diff --git a/src/XMonad/Core.hs b/src/XMonad/Core.hs index b4d03cb..c79b992 100644 --- a/src/XMonad/Core.hs +++ b/src/XMonad/Core.hs @@ -440,8 +440,14 @@ runOnWorkspaces job = do $ current ws : visible ws modify $ \s -> s { windowset = ws { current = c, visible = v, hidden = h } } --- | Return the path to the xmonad configuration directory. Several --- directories are considered. In order of preference: +-- | Return the path to the xmonad configuration directory. This +-- directory is where user configuration files are stored (e.g, the +-- xmonad.hs file). You may also create a @lib@ subdirectory in the +-- configuration directory and the default recompile command will add +-- it to the GHC include path. +-- +-- Several directories are considered. In order of +-- preference: -- -- 1. The directory specified in the @XMONAD_CONFIG_DIR@ environment variable. -- 2. The @XDG_CONFIG_HOME/xmonad@ directory. @@ -457,8 +463,11 @@ getXMonadDir = , getAppUserDataDirectory "xmonad" ] --- | Return the path to the xmonad cache directory. Several --- directories are considered. In order of preference: +-- | Return the path to the xmonad cache directory. This directory is +-- used to store temporary files that can easily be recreated. For +-- example, the XPrompt history file. +-- +-- Several directories are considered. In order of preference: -- -- 1. The directory specified in the @XMONAD_CACHE_DIR@ environment variable. -- 2. The @XDG_CACHE_HOME/xmonad@ directory. @@ -474,8 +483,11 @@ getXMonadCacheDir = , getAppUserDataDirectory "xmonad" ] --- | Return the path to the xmonad data directory. Several --- directories are considered. In order of preference: +-- | Return the path to the xmonad data directory. This directory is +-- used by XMonad to store data files such as the run-time state file +-- and the configuration binary generated by GHC. +-- +-- Several directories are considered. In order of preference: -- -- 1. The directory specified in the @XMONAD_DATA_DIR@ environment variable. -- 2. The @XDG_DATA_HOME/xmonad@ directory. diff --git a/src/XMonad/Main.hs b/src/XMonad/Main.hs index fd051be..3b6ace1 100644 --- a/src/XMonad/Main.hs +++ b/src/XMonad/Main.hs @@ -184,6 +184,8 @@ launch initxmc = do -- (ugly, I know) xSetErrorHandler -- in C, I'm too lazy to write the binding: dons + xinesc <- getCleanedScreenInfo dpy + nbc <- do v <- initColor dpy $ normalBorderColor xmc ~(Just nbc_) <- initColor dpy $ normalBorderColor Default.def return (fromMaybe nbc_ v) @@ -193,7 +195,6 @@ launch initxmc = do return (fromMaybe fbc_ v) hSetBuffering stdout NoBuffering - xinesc <- getCleanedScreenInfo dpy let layout = layoutHook xmc lreads = readsLayout layout diff --git a/src/XMonad/Operations.hs b/src/XMonad/Operations.hs index 4e17484..aa44dcd 100644 --- a/src/XMonad/Operations.hs +++ b/src/XMonad/Operations.hs @@ -469,7 +469,7 @@ writeStateToFile = do readStateFile :: (LayoutClass l Window, Read (l Window)) => XConfig l -> X (Maybe XState) readStateFile xmc = do path <- stateFileName - raw <- userCode $ io (readFile path <* removeFile path) + raw <- userCode $ io (readFile path) return $ do sf <- maybeRead reads =<< raw