parkouss / webmacs

webmacs - keyboard driven (emacs key bindings) browser, https://webmacs.readthedocs.io/en/latest/
GNU General Public License v3.0
157 stars 21 forks source link

Follow XDG base directory specification #104

Open TLATER opened 5 years ago

TLATER commented 5 years ago

Fixes #95.

For now, this implements the second suggested strategy (continue supporting the old path with a deprecation warning, but prefer the new path), and splits the configuration and other data directories between $XDG_DATA_HOME and $XDG_CONFIG_HOME.

Furthermore, this branch makes the configuration directory configurable with -c. The profile/log/adblock directory is not configurable via CLI, this is intentional since IME other applications don't allow this either, and it seems a little pointless - the user should never need to touch these files anyway, and can always just use $XDG_DATA_HOME.

I also don't really see the point to adding a webmacs://config page just to display this directory. Perhaps if we allowed in-browser editing of the init module, but that's a bit beyond the scope of this patch.

I've done some smoketesting (and am using the branch as we speak!), but I can't get the tests to run :(

TLATER commented 5 years ago

There's slightly unexpected behavior still, in that, if a user sets -c, but there is no configuration directory there, webmacs will still use an existing ~/.webmacs. Getting around that would be a bit less clean, and we do have the deprecation warning - opinions?

parkouss commented 5 years ago

Hey, thanks for looking into this. :) For your question, well it would be best to honor the -c option, but it is acceptable like this I think.

I agree with the changes here, but I thought about it a bit, and maybe we should also make use of the XDG_CACHE_HOME env var to put the cache used by the browser - which can be quite huge.

Though this will be a more complex change I think, so maybe we can start with this. Do you want me to merge the patch as it is now?

For the tests, have you followed https://github.com/parkouss/webmacs#running-tests? if yes, maybe you could tell me what's wrong, it is possible that the documentation here is incomplete.

TLATER commented 5 years ago

@parkouss I haven't quite grokked the whole project yet, so I wasn't sure how to move around the browser cache - definitely agree though, it's very handy to just go rm -rf ~/.cache.

Maybe when I get a bit more time, might be a few weeks. It's up to you to tell if this is up to par as-is :)

I have a fairly exotic setup and herbstluftwm didn't seem to like it much. I frankly gave up pretty quickly, I'll put a bit more effort in next time and document anything I need to do to get it to work over here.

TLATER commented 5 years ago

I've updated the patch :) It now also puts webmacs.ipc in $XDG_RUNTIME_DIR (#107) and splits off the cache directory into $XDG_CACHE_HOME/webmacs.

The default $XDG_RUNTIME_DIR is either [/usr]/run/user/<uid>, or if those don't exist /tmp/.webmacs - the XDG specification isn't perfectly clear on this, but I think that's implied from some prodding around other applications.

I don't think we need a separate deprecation warning for the cache, since it's fundamentally temporary data, so we should be free to clear it.