thestinger / termite

Termite is obsoleted by Alacritty. Termite was a keyboard-centric VTE-based terminal, aimed at use within a window manager with tiling and/or tabbing support.
https://github.com/alacritty/alacritty
2.73k stars 240 forks source link

Add support for overriding config file. #671

Closed HugoNikanor closed 3 years ago

HugoNikanor commented 5 years ago

Allows '-C' flag to specify a config file which should take priority over already set config. Ideally multiple config files should be able to be loaded in this way. See this as more of a proof of concept.

I personally wants this to easily switch fonts without copying my whole config.

jelly commented 5 years ago

This looks like a workaround for something, iirc termite supports reloading of the config file.

HugoNikanor commented 5 years ago

@jelly This is separate from reloading config files. It instead allows the user to supplement an additional config file which can override default. I do agree that this might be a bit of a workaround-ish solution.

wlhlm commented 5 years ago

This should be documented in the man page in case this gets merged.

HugoNikanor commented 5 years ago

I added a note in the appropriate man page.

However, I would still like to see some further thoughts on a feature like this.

polyzen commented 5 years ago

https://github.com/thestinger/termite/issues/260

HugoNikanor commented 5 years ago

@polyzen I also like that approach, but @thestinger was was apparently against without giving a reason.

ifohancroft commented 4 years ago

This is already possible with the present -c option. termite(1):

-c, --config=CONFIG Specify a path to an alternative config file to use.

If it's something else you are asking for - please elaborate.

HugoNikanor commented 4 years ago

@ifohancroft I'm well aware of the -c flag. My use case for this is to have multiple really similar configs (which I can choose between with the -c flag) and then some minor amendments I can load with the -C flag. I currently use it to create a new instance with a different font but all other settings intact.

ifohancroft commented 4 years ago

@HugoNikanor I am sorry. I misunderstood your use case. I get now what you are trying to do and I think the idea is cool. I am not sure about the implementation though. I am thinking a cooler or more elegant way would be to either present what's in the config, also as a runtime option that takes precedence over the config or maybe modifying how -c works, so instead of just loading what's provided by -c, it also loads the default config file and what's present in both the default one and in the -c one, the -c one overrides it.

HugoNikanor commented 4 years ago

@ifohancroft Your second idea sounds like making the -c flag act as my -C flag. I would like to think that it's a bad idea, since I excpect -c /dev/null to load default setting. That however doesn't work with the error /dev/null parsing failed: Not a regular file. So it could be an idea.

Regarding your first idea. Do you mean something along the lines of -o options.font='Fira Mono 8'?

ifohancroft commented 4 years ago

@HugoNikanor Why would you expect -c /dev/null to load the default setting? Instead of passing /dev/null to -c, wouldn't it be better to just not specify -c? I mean, after all termite by default is looking in a specific dir for the default config file.

As for the first idea. Your idea to combine them under a single option is nice. Like -o options.font='Fire Mono 8'. I was thinking more like separate options: --font='Fire Mono 8' --color0='#000000', etc

HugoNikanor commented 4 years ago

The "default" with -c /dev/null would be termites built in defaults, NOT the users defaults. The idea being that /dev/null is an empty file, so no config would be loaded.

Individual flags for all options could work, but it becomes a problem as soon as we have the same key in multiple sections, and it would require a constant maintenance of another source of configs. -o flags would allow parsing depending on what's allowed in our config file.

-- Hugo Hörnquist On Tue, Oct 08, 2019 at 09:45:54AM -0700, IFo Hancroft wrote:

@HugoNikanor Why would you expect -c /dev/null to load the default setting? Instead of passing /dev/null to -c, wouldn't it be better to just not specify -c? I mean, after all termite by default is looking in a specific dir for the default config file.

As for the first idea. Your idea to combine them under a single option is nice. Like -o options.font='Fire Mono 8'. I was thinking more like separate options: --font='Fire Mono 8' --color0='#000000', etc

-- You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub: https://github.com/thestinger/termite/pull/671#issuecomment-539601945

ifohancroft commented 4 years ago

This sounds a bit of an overkill. Also, I think Termite doesn't have built-in defaults and reads them from the config file. I think it would be sufficient to just read the default config, also of course, the current - c option to load an alternative config instead and options when running it like --color0, --color1, etc to override just the specified. The same can still be achieved this way.

thestinger commented 3 years ago

Termite is obsolete. Please use Alacritty instead. See https://github.com/thestinger/termite#termite-is-obsoleted-by-alacritty for more details.