New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Revise XDG handling #258
Revise XDG handling #258
Conversation
9fdadaa
to
6baf36c
Compare
e8f44bb
to
9caade1
Compare
@geekosaur @liskin @psibi what do you people think? I think the abstract approach mentioned in #256 is sound and this implementation "works for me" and shouldn't break any existing configs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM apart from minor haddock issue. I will merge this in a couple of days unless there is objection from others.
3de1064
to
41066ad
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good work fixing this stuff! 👍
Found a mistake in env var handling, the rest are just doc/code improvement suggestions.
7383a3d
to
0d9c56b
Compare
Improve handling of the whole XDG situation. This now looks as follows 1. If all three of xmonad's environment variables (XMONAD_DATA_DIR, XMONAD_CONFIG_DIR, and XMONAD_CACHE_DIR) are set, use them. 2. If there is a build script `build' or configuration `xmonad.hs' in `~/.xmonad', set all three directories to `~/.xmonad'. 3. Otherwise, use XDG_DATA_HOME, XDG_CONFIG_HOME, and XDG_CACHE_HOME (or their respective fallbacks). If none of the above exist, we default to using the XDG_* variables, creating the necessary directories if needed.
-- 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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a bit funny that the configuration binary, which can be easily recreated, gets placed in dataDir, whereas the prompt history, which requires superhuman memory abilities or superhuman backup regime to recreate, goes in cacheDir. But xmonad isn't the only program that does it this way so I guess it doesn't matter.
With the bumped xmonad dependency, we can drop these, leaving just 4 warnings visible in ghcid. \o/ Related: xmonad/xmonad#258
Description
Fixes #164 and #256
I'm putting this out here in a relatively early state, because I know
opinions are to be had on a lot of these things, so I'd rather not wait
until this is more mature for people to say I've done something horribly
wrong.
As per #256, this puts forth the following changes to how we handle the
whole config situation.
XMONAD_DATA_DIR,
XMONAD_CONFIG_DIR
, andXMONAD_CACHE_DIR
) are set, use them.build
or configurationxmonad.hs
in~/.xmonad
, set all three directories to~/.xmonad
.XDG_DATA_HOME
,XDG_CONFIG_HOME
, andXDG_CACHE_HOME
(or their respective fallbacks).If none of the above exist, we default to using the XDG_* variables,
creating the necessary directories if needed.
In the cases of 1. and 3., the build script or executable is expected to
be in the config dir (this is the case at the moment as well).
This doesn't quite compile with
xmonad-contrib
yet, though therearen't very many changes needed to make it work. I've created a quick
fix on this branch, in case anyone wants to try this. From my (very) light
testing so far, it at least seems to do what it's supposed to.
Checklist
I've read CONTRIBUTING.md
I've confirmed these changes don't belong in xmonad-contrib instead
I tested my changes with xmonad-testing
I updated the
CHANGES.md
file