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

Consider adding XDG Base Directory support for minttyrc #525

Closed
raetiacorvus opened this Issue Mar 13, 2016 · 10 comments

Comments

Projects
None yet
3 participants
@raetiacorvus

raetiacorvus commented Mar 13, 2016

It would be nice if mintty would add support for the XDG_CONFIG_HOME location as defined in the XDG Base Directory Specification which should default to HOME/.config/ if not set.
So basically mintty should looking for a XDG_CONFIG_HOME/mintty/config before looking for ~/.minttyrc

@mintty

This comment has been minimized.

Show comment
Hide comment
@mintty

mintty Mar 13, 2016

Owner

Although the cygwin installation of mintty supports an xdg menu entry already, I am not aware that XDG is wide-spread. Which similar applications use that configuration? Any terminals?
Would $XDG_CONFIG_HOME/mintty/config be the name of the config file or a folder for .minttyrc? Where in the spec is this defined?

Owner

mintty commented Mar 13, 2016

Although the cygwin installation of mintty supports an xdg menu entry already, I am not aware that XDG is wide-spread. Which similar applications use that configuration? Any terminals?
Would $XDG_CONFIG_HOME/mintty/config be the name of the config file or a folder for .minttyrc? Where in the spec is this defined?

@raetiacorvus

This comment has been minimized.

Show comment
Hide comment
@raetiacorvus

raetiacorvus Mar 13, 2016

XDG Base directorys usage has become more widely spread. For a short overview you of some application support the arch wiki is a nice source.
In $XDG_CONFIG_HOME/mintty/config config would be a file and mintty the subdir as specified in point two. But config is just an example for the config file name. Git uses it. The filename could stay minttyrc, or .minttyrc.

Specifications may reference this specification by specifying the location of a configuration file as $XDG_CONFIG_DIRS/subdir/filename. This implies that:

  • Default configuration files should be installed to $sysconfdir/xdg/subdir/filename with $sysconfdir defaulting to /etc.
  • A user specific version of the configuration file may be created in $XDG_CONFIG_HOME/subdir/filename, taking into account the default value for $XDG_CONFIG_HOME if $XDG_CONFIG_HOME is not set.
  • Lookups of the configuration file should search for ./subdir/filename relative to all base directories indicated by $XDG_CONFIG_HOME and $XDG_CONFIG_DIRS . If an environment variable is either not set or empty, its default value as defined by this specification should be used instead.

raetiacorvus commented Mar 13, 2016

XDG Base directorys usage has become more widely spread. For a short overview you of some application support the arch wiki is a nice source.
In $XDG_CONFIG_HOME/mintty/config config would be a file and mintty the subdir as specified in point two. But config is just an example for the config file name. Git uses it. The filename could stay minttyrc, or .minttyrc.

Specifications may reference this specification by specifying the location of a configuration file as $XDG_CONFIG_DIRS/subdir/filename. This implies that:

  • Default configuration files should be installed to $sysconfdir/xdg/subdir/filename with $sysconfdir defaulting to /etc.
  • A user specific version of the configuration file may be created in $XDG_CONFIG_HOME/subdir/filename, taking into account the default value for $XDG_CONFIG_HOME if $XDG_CONFIG_HOME is not set.
  • Lookups of the configuration file should search for ./subdir/filename relative to all base directories indicated by $XDG_CONFIG_HOME and $XDG_CONFIG_DIRS . If an environment variable is either not set or empty, its default value as defined by this specification should be used instead.
@mperry2

This comment has been minimized.

Show comment
Hide comment
@mperry2

mperry2 Apr 14, 2016

I'd also like to see support for this. I'd prefer $XDG_CONFIG_HOME/mintty/config as the config file so my home directory isn't cluttered with so many dotfiles.

mperry2 commented Apr 14, 2016

I'd also like to see support for this. I'd prefer $XDG_CONFIG_HOME/mintty/config as the config file so my home directory isn't cluttered with so many dotfiles.

@mintty

This comment has been minimized.

Show comment
Hide comment
@mintty

mintty Apr 15, 2016

Owner

I plan to support $XDG_CONFIG_HOME/mintty/config with a fallback to $HOME/.config/mintty/config as specified. However, if $HOME/.minttyrc exists, too, which one should get precedence? I don't see a comment on that in the XDG specs. Furthermore, considering #201, I'm considering to also support $APPDATA/mintty/config. Which should be the order of precedence then?

Owner

mintty commented Apr 15, 2016

I plan to support $XDG_CONFIG_HOME/mintty/config with a fallback to $HOME/.config/mintty/config as specified. However, if $HOME/.minttyrc exists, too, which one should get precedence? I don't see a comment on that in the XDG specs. Furthermore, considering #201, I'm considering to also support $APPDATA/mintty/config. Which should be the order of precedence then?

@raetiacorvus

This comment has been minimized.

Show comment
Hide comment
@raetiacorvus

raetiacorvus Apr 15, 2016

Git reads from all of them in the order found here. With last value found taking precedence. It would be nice if mintty would do somethings similar.
For backward compatibility this probably would mean if a $HOME/.minttyrc exists, write config changes to that file as settings there would overrule settings in earlier files. And if it does not exist write settings to $XDG_CONFIG_HOME/mintty/config.
The alternative would be a migration check and to move a found $HOME/.minttyrc to $XDG_CONFIG_HOME/mintty/config but that does not solve the case what to do if both files exist.

raetiacorvus commented Apr 15, 2016

Git reads from all of them in the order found here. With last value found taking precedence. It would be nice if mintty would do somethings similar.
For backward compatibility this probably would mean if a $HOME/.minttyrc exists, write config changes to that file as settings there would overrule settings in earlier files. And if it does not exist write settings to $XDG_CONFIG_HOME/mintty/config.
The alternative would be a migration check and to move a found $HOME/.minttyrc to $XDG_CONFIG_HOME/mintty/config but that does not solve the case what to do if both files exist.

@mperry2

This comment has been minimized.

Show comment
Hide comment
@mperry2

mperry2 Apr 16, 2016

In my opinion $HOME/.minttyrc should be looked for last since one of the points of the XDG spec is to reduce the clutter of dot files in the home directory.

I agree with @sirblackheart that the default config file should be $XDG_CONFIG_HOME/mintty/config and the settings should be saved there if no other config file exists.

As for issue #201, that appears to be a problem with the environment that msysgit provides, not with mintty. They should be the ones to fix it.

mperry2 commented Apr 16, 2016

In my opinion $HOME/.minttyrc should be looked for last since one of the points of the XDG spec is to reduce the clutter of dot files in the home directory.

I agree with @sirblackheart that the default config file should be $XDG_CONFIG_HOME/mintty/config and the settings should be saved there if no other config file exists.

As for issue #201, that appears to be a problem with the environment that msysgit provides, not with mintty. They should be the ones to fix it.

@mintty

This comment has been minimized.

Show comment
Hide comment
@mintty

mintty May 3, 2016

Owner

Modifying the plan, mintty should inspect config files in this order, giving precedence to the latest found and saving changes to that:

  • /etc/minttyrc
  • $APPDATA/mintty/config
  • ~/.config/mintty/config
  • (perhaps ~/.mintty/config)
  • ~/.minttyrc

(Note that ~ is almost but not quite the same as $HOME)

And subdirectories sounds and themes shall be looked for in $APPDATA/mintty and ~/.config/mintty (and perhaps ~/.mintty, also perhaps /usr/share/mintty first).

(Not sure yet about ~/.mintty which was only recently introduced.)

This means the default XDG config directory will be supported but the environment variable XDG_CONFIG_HOME shall not be checked. The reason is that this would be asking for trouble because normally (esp. when mintty gets started from a desktop shortcut) this variable would not yet be defined when mintty starts, so people would wonder and complain why it is sometimes effective and sometimes not.

Owner

mintty commented May 3, 2016

Modifying the plan, mintty should inspect config files in this order, giving precedence to the latest found and saving changes to that:

  • /etc/minttyrc
  • $APPDATA/mintty/config
  • ~/.config/mintty/config
  • (perhaps ~/.mintty/config)
  • ~/.minttyrc

(Note that ~ is almost but not quite the same as $HOME)

And subdirectories sounds and themes shall be looked for in $APPDATA/mintty and ~/.config/mintty (and perhaps ~/.mintty, also perhaps /usr/share/mintty first).

(Not sure yet about ~/.mintty which was only recently introduced.)

This means the default XDG config directory will be supported but the environment variable XDG_CONFIG_HOME shall not be checked. The reason is that this would be asking for trouble because normally (esp. when mintty gets started from a desktop shortcut) this variable would not yet be defined when mintty starts, so people would wonder and complain why it is sometimes effective and sometimes not.

@mintty

This comment has been minimized.

Show comment
Hide comment
@mintty

mintty May 22, 2016

Owner

Released in 2.3.7.

Owner

mintty commented May 22, 2016

Released in 2.3.7.

@mintty mintty closed this May 22, 2016

mintty added a commit that referenced this issue Jun 24, 2016

load theme and bell sound resources also from XDG default config dir (#…
…525), Windows AppData dir, or /usr/share/mintty

enable cygwin path style for wave file configuration
@mintty

This comment has been minimized.

Show comment
Hide comment
@mintty

mintty Jun 28, 2016

Owner

Mintty now also supports the XDG default base directory for subfolders for resource files:
colour schemes ("themes") and wave files (for bell sound).

Owner

mintty commented Jun 28, 2016

Mintty now also supports the XDG default base directory for subfolders for resource files:
colour schemes ("themes") and wave files (for bell sound).

@mintty

This comment has been minimized.

Show comment
Hide comment
@mintty

mintty Jul 7, 2016

Owner

Extended XDG directory handling to other resouce files (colour themes, sound wave files).
Released with 2.4.0.

Owner

mintty commented Jul 7, 2016

Extended XDG directory handling to other resouce files (colour themes, sound wave files).
Released with 2.4.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment