Skip to content
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

Accept multiple directories as extras #1212

Open
2 tasks done
o01eg opened this issue Jul 12, 2019 · 9 comments
Open
2 tasks done

Accept multiple directories as extras #1212

o01eg opened this issue Jul 12, 2019 · 9 comments

Comments

@o01eg
Copy link

o01eg commented Jul 12, 2019

Xi-Editor Issue Template

  • I have searched existing issues and could not find my issue.
  • I have studied the documentation.

Expected vs Actual

Actually client can set only one extras dir.

In a discussion xi-frontend/xi-term#110 it was mentioned to use XDG specification XDG_DATA_DIRS to place system-wide installed plugins, which is a collection of directories.

Can protocol be updated to allow client to set multiple directories for extras?

@Cogitri
Copy link
Member

Cogitri commented Jul 12, 2019

Hm, although I don't really oppose this wouldn't the current approach work for xi-term too? Setting config_dir (allowing users to put stuff in their $HOME) as it currently does and setting extra_dir to some other dir (e.g. /usr/libexec/xi-term, maybe via an env plugin) would do the trick too since XDG_DATA_DIRS most definitely isn't the right place for plugins. Another problem is predictability: How should xi-core choose what dir to use? The first one with a plugin in it? All of them? Xi also makes a theme cache, in which dir should that be in?

@o01eg
Copy link
Author

o01eg commented Jul 12, 2019

Hm, although I don't really oppose this wouldn't the current approach work for xi-term too? Setting config_dir (allowing users to put stuff in their $HOME) as it currently does and setting extra_dir to some other dir (e.g. /usr/libexec/xi-term, maybe via an env plugin) would do the trick too since XDG_DATA_DIRS most definitely isn't the right place for plugins.

Yes, but it's a more general issue to allow multiple extras directories.

Another problem is predictability: How should xi-core choose what dir to use? The first one with a plugin in it? All of them?

I suppose xi-core could use all of them, ConfigManager::get_plugin_paths already returns multiple directories.

Xi also makes a theme cache, in which dir should that be in?

Not sure about Windows, but on Linux it should use XDG_CACHE_HOME.

@Cogitri
Copy link
Member

Cogitri commented Jul 12, 2019

Not sure about Windows, but on Linux it should use XDG_CACHE_HOME.

Which isn't available on all systems, let alone be handled by xi. I guess we could add a 3rd parameter to client_started

@cmyr
Copy link
Member

cmyr commented Jul 17, 2019

My memory isn't totally clear but I believe xi does allow the frontend to provide two config directories, a 'system' one and a 'user' one. The idea being that the frontend can put bundled plugins and themes somewhere private, without the user stepping on them.

You specify this with the client_extras_dir dir argument to client_started. This may only be for plugins, I'm not totally sure, but it is used in xi-mac so it should work. :)

@Cogitri
Copy link
Member

Cogitri commented Jul 17, 2019

My memory isn't totally clear but I believe xi does allow the frontend to provide two config directories, a 'system' one and a 'user' one.

Yup, but the goal here was to use the XDG variables (basically standard dirs on linux for stuff like Downloads, Documents, Shared Files and so on), which includes multiple dirs (e.g. $HOME/. local/share:/usr/local/share:/usr/share so that the user can place the plugins in either of those dirs.

@cmyr
Copy link
Member

cmyr commented Jul 17, 2019

I think in the particular case described above the current mechanism would work, though; the client just sends $XDG_DATA_DIR/xi/plugins as client_extras_dir. I don't have any ambition to support an arbitrary number of paths; I don't see a super compelling use case there.

@Cogitri
Copy link
Member

Cogitri commented Jul 17, 2019

described above the current mechanism would work, though; the client just sends $XDG_DATA_DIR/xi/plugins as client_extras_dir

But XDG_DATA_DIR maps to multiple dirs, so that's not possible as of now.

Anyway, I don't think it's worth it supporting multiple dirs either, it'd need some logic behind what path to prefer for conflicting files which I'd rather not have.
Would it be possible to just bake one dir into xi-term, @o01eg ? Tau does that to set a plugin dir.

@o01eg
Copy link
Author

o01eg commented Jul 17, 2019

Anyway, I don't think it's worth it supporting multiple dirs either, it'd need some logic behind what path to prefer for conflicting files which I'd rather not have.

XDG_DATA_DIRS is already preference-ordered as it is noted in specification.

Would it be possible to just bake one dir into xi-term, @o01eg ? Tau does that to set a plugin dir.

It possible to take first directory from XDG_DATA_DIRS, I think.

@Cogitri
Copy link
Member

Cogitri commented Jul 17, 2019

XDG_DATA_DIRS is already preference-ordered as it is noted in specification.

Yes, but frontends may specify dirs that aren't in the XDG standard too, so we'd need some logic behind this (e.g. with an enum which allows the front-end to select between different approaches for this).

Anyway, in the short-term xi-term should just select one dir. Maybe you could draft a PR for xi-editor if you're interested in seeing this land?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants