mirror of
https://github.com/xmonad/xmonad.git
synced 2025-05-19 08:30:21 -07:00
Merge branch 'master' into master
This commit is contained in:
commit
63d6a66133
@ -20,6 +20,9 @@
|
|||||||
|
|
||||||
* Compiles with GHC 8.4.0
|
* Compiles with GHC 8.4.0
|
||||||
|
|
||||||
|
* Restored compatability with GHC version prior to 8.0.1 by removing the
|
||||||
|
dependency on directory version 1.2.3.
|
||||||
|
|
||||||
## 0.13 (February 10, 2017)
|
## 0.13 (February 10, 2017)
|
||||||
|
|
||||||
### Breaking Changes
|
### Breaking Changes
|
||||||
|
@ -58,6 +58,7 @@ import Data.Typeable
|
|||||||
import Data.List ((\\))
|
import Data.List ((\\))
|
||||||
import Data.Maybe (isJust,fromMaybe)
|
import Data.Maybe (isJust,fromMaybe)
|
||||||
import Data.Monoid hiding ((<>))
|
import Data.Monoid hiding ((<>))
|
||||||
|
import System.Environment (lookupEnv)
|
||||||
|
|
||||||
import qualified Data.Map as M
|
import qualified Data.Map as M
|
||||||
import qualified Data.Set as S
|
import qualified Data.Set as S
|
||||||
@ -467,7 +468,7 @@ getXMonadDir :: MonadIO m => m String
|
|||||||
getXMonadDir =
|
getXMonadDir =
|
||||||
findFirstDirWithEnv "XMONAD_CONFIG_DIR"
|
findFirstDirWithEnv "XMONAD_CONFIG_DIR"
|
||||||
[ getAppUserDataDirectory "xmonad"
|
[ getAppUserDataDirectory "xmonad"
|
||||||
, getXdgDirectory XdgConfig "xmonad"
|
, getXDGDirectory XDGConfig "xmonad"
|
||||||
]
|
]
|
||||||
|
|
||||||
-- | Return the path to the xmonad cache directory. This directory is
|
-- | Return the path to the xmonad cache directory. This directory is
|
||||||
@ -487,7 +488,7 @@ getXMonadCacheDir :: MonadIO m => m String
|
|||||||
getXMonadCacheDir =
|
getXMonadCacheDir =
|
||||||
findFirstDirWithEnv "XMONAD_CACHE_DIR"
|
findFirstDirWithEnv "XMONAD_CACHE_DIR"
|
||||||
[ getAppUserDataDirectory "xmonad"
|
[ getAppUserDataDirectory "xmonad"
|
||||||
, getXdgDirectory XdgCache "xmonad"
|
, getXDGDirectory XDGCache "xmonad"
|
||||||
]
|
]
|
||||||
|
|
||||||
-- | Return the path to the xmonad data directory. This directory is
|
-- | Return the path to the xmonad data directory. This directory is
|
||||||
@ -507,7 +508,7 @@ getXMonadDataDir :: MonadIO m => m String
|
|||||||
getXMonadDataDir =
|
getXMonadDataDir =
|
||||||
findFirstDirWithEnv "XMONAD_DATA_DIR"
|
findFirstDirWithEnv "XMONAD_DATA_DIR"
|
||||||
[ getAppUserDataDirectory "xmonad"
|
[ getAppUserDataDirectory "xmonad"
|
||||||
, getXdgDirectory XdgData "xmonad"
|
, getXDGDirectory XDGData "xmonad"
|
||||||
]
|
]
|
||||||
|
|
||||||
-- | Helper function that will find the first existing directory and
|
-- | Helper function that will find the first existing directory and
|
||||||
@ -543,6 +544,27 @@ findFirstDirWithEnv envName paths = do
|
|||||||
Nothing -> findFirstDirOf paths
|
Nothing -> findFirstDirOf paths
|
||||||
Just envPath -> findFirstDirOf (return envPath:paths)
|
Just envPath -> findFirstDirOf (return envPath:paths)
|
||||||
|
|
||||||
|
-- | Helper function to retrieve the various XDG directories.
|
||||||
|
-- This has been based on the implementation shipped with GHC version 8.0.1 or
|
||||||
|
-- higher. Put here to preserve compatibility with older GHC versions.
|
||||||
|
getXDGDirectory :: XDGDirectory -> FilePath -> IO FilePath
|
||||||
|
getXDGDirectory xdgDir suffix =
|
||||||
|
normalise . (</> suffix) <$>
|
||||||
|
case xdgDir of
|
||||||
|
XDGData -> get "XDG_DATA_HOME" ".local/share"
|
||||||
|
XDGConfig -> get "XDG_CONFIG_HOME" ".config"
|
||||||
|
XDGCache -> get "XDG_CACHE_HOME" ".cache"
|
||||||
|
where
|
||||||
|
get name fallback = do
|
||||||
|
env <- lookupEnv name
|
||||||
|
case env of
|
||||||
|
Nothing -> fallback'
|
||||||
|
Just path
|
||||||
|
| isRelative path -> fallback'
|
||||||
|
| otherwise -> return path
|
||||||
|
where
|
||||||
|
fallback' = (</> fallback) <$> getHomeDirectory
|
||||||
|
data XDGDirectory = XDGData | XDGConfig | XDGCache
|
||||||
|
|
||||||
-- | Get the name of the file used to store the xmonad window state.
|
-- | Get the name of the file used to store the xmonad window state.
|
||||||
stateFileName :: (Functor m, MonadIO m) => m FilePath
|
stateFileName :: (Functor m, MonadIO m) => m FilePath
|
||||||
|
@ -71,7 +71,7 @@ library
|
|||||||
build-depends: base < 5 && >=3,
|
build-depends: base < 5 && >=3,
|
||||||
containers,
|
containers,
|
||||||
data-default,
|
data-default,
|
||||||
directory >= 1.2.3,
|
directory,
|
||||||
extensible-exceptions,
|
extensible-exceptions,
|
||||||
filepath,
|
filepath,
|
||||||
setlocale,
|
setlocale,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user