Use multiple config files to separate settings that are machine-specific #16074

Closed
opened 2026-01-31 04:56:41 +00:00 by claunia · 5 comments
Owner

Originally created by @rbanffy on GitHub (Dec 8, 2021).

Use multiple config files so that personal preferences can be split from machine-specific options

Like many people, I keep a dotfiles repo. When using multiple Windows machines, the installed WSL hosts are different and, therefore, it's not possible to share the settings.json file between multiple computers because the elements under profiles.list are different, while profiles.defaults is safe to share between computers.

I would suggest Terminal to use a second JSON file under LocalState to keep the profiles.list entries to make it easy to keep settings.json safe to share between multiple machines while keeping unrelated settings in a separate file. Also, the defaultProfile key would need to be moved into this new file, and JSON schemas should be adjusted to reflect that.

Originally created by @rbanffy on GitHub (Dec 8, 2021). <!-- 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨 I ACKNOWLEDGE THE FOLLOWING BEFORE PROCEEDING: 1. If I delete this entire template and go my own path, the core team may close my issue without further explanation or engagement. 2. If I list multiple bugs/concerns in this one issue, the core team may close my issue without further explanation or engagement. 3. If I write an issue that has many duplicates, the core team may close my issue without further explanation or engagement (and without necessarily spending time to find the exact duplicate ID number). 4. If I leave the title incomplete when filing the issue, the core team may close my issue without further explanation or engagement. 5. If I file something completely blank in the body, the core team may close my issue without further explanation or engagement. All good? Then proceed! --> # Use multiple config files so that personal preferences can be split from machine-specific options Like many people, I keep a dotfiles repo. When using multiple Windows machines, the installed WSL hosts are different and, therefore, it's not possible to share the settings.json file between multiple computers because the elements under profiles.list are different, while profiles.defaults is safe to share between computers. I would suggest Terminal to use a second JSON file under LocalState to keep the profiles.list entries to make it easy to keep settings.json safe to share between multiple machines while keeping unrelated settings in a separate file. Also, the defaultProfile key would need to be moved into this new file, and JSON schemas should be adjusted to reflect that.
claunia added the Issue-FeatureResolution-Duplicate labels 2026-01-31 04:56:42 +00:00
Author
Owner

@zadjii-msft commented on GitHub (Dec 8, 2021):

A pile of things that are all related:

it's not possible to share the settings.json file between multiple computers because the elements under profiles.list are different

It should also mostly work. The WSL profiles the Terminal generates for you are "dynamic profiles", which means that the Termnial recognizes that those profiles come from somewhere else, which may or may not exist. So the Terminal is smart enough to hide those profiles if you were to uninstall the distro, or move the file to a machine that doesn't have that WSL distro installed. We actually used to also roam the settings.json file across machines, which was part of what necessitated such functionality.

That being said, if you add your own WSL profiles pointing at specific distros, then the Terminal isn't going to be able to figure those out for you.

Of course, you can also use fragments for this. Just create a file in:

C:\ProgramData\Microsoft\Windows Terminal\Fragments\{app-name}\{file-name}.json

({app-name} and {file-name} can be literally anything, doesn't matter)

and then put whatever machine-specific profiles you want in there.

/dup #2933

@zadjii-msft commented on GitHub (Dec 8, 2021): A pile of things that are all related: * #2933 * #641 * #2303 > it's not possible to share the settings.json file between multiple computers because the elements under profiles.list are different It should also _mostly work_. The WSL profiles the Terminal generates for you are "dynamic profiles", which means that the Termnial recognizes that those profiles come from _somewhere else_, which may or may not exist. So the Terminal is smart enough to hide those profiles if you were to uninstall the distro, or move the file to a machine that doesn't have that WSL distro installed. We actually used to also roam the `settings.json` file across machines, which was part of what necessitated such functionality. That being said, if you add your own WSL profiles pointing at specific distros, then the Terminal isn't going to be able to figure those out for you. Of course, you can also use [fragments ](https://docs.microsoft.com/en-us/windows/terminal/json-fragment-extensions)for this. Just create a file in: ``` C:\ProgramData\Microsoft\Windows Terminal\Fragments\{app-name}\{file-name}.json ``` (`{app-name}` and `{file-name}` can be literally anything, doesn't matter) and then put whatever machine-specific profiles you want in there. /dup #2933
Author
Owner

@ghost commented on GitHub (Dec 8, 2021):

Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report!

@ghost commented on GitHub (Dec 8, 2021): Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report!
Author
Owner

@rbanffy commented on GitHub (Dec 8, 2021):

Thank you for the prompt response, @zadjii-msft. I did a couple dozen searches before not finding the issues you pointed to.

It kind of works, but, in this specific case, I'm not sure the fragments approach will solve - the settings I'd like to share are not specific to a profile, but are on the profiles.defaults key (I change the font face for all profiles). I'll give it a try as soon as I get back to a Windows machine where I can test it.

In any case, having profiles and settings on separate would still be a good idea. I made a note on #641, which seems like a closer idea to this one.

@rbanffy commented on GitHub (Dec 8, 2021): Thank you for the prompt response, @zadjii-msft. I did a couple dozen searches before not finding the issues you pointed to. It kind of works, but, in this specific case, I'm not sure the fragments approach will solve - the settings I'd like to share are not specific to a profile, but are on the profiles.defaults key (I change the font face for all profiles). I'll give it a try as soon as I get back to a Windows machine where I can test it. In any case, having profiles and settings on separate would still be a good idea. I made a note on #641, which seems like a closer idea to this one.
Author
Owner

@zadjii-msft commented on GitHub (Dec 8, 2021):

Oh I mean, so I'm thinking:

  • Leave all the settings you want on all machines in settings.json. sync that to your different devices however you want. Fill in the profiles.defaults there with whatever you want.
  • In the terminal fragments, add all your per-machine profiles. So here you'd add your WSL's, your various different workspaces, etc.

So the one you're putting in the normal settings file is only the things that'll work on every machine.

(Maybe I'm still misunderstanding though ☺️)

@zadjii-msft commented on GitHub (Dec 8, 2021): Oh I mean, so I'm thinking: * Leave all the settings you want on all machines in `settings.json`. sync that to your different devices however you want. Fill in the `profiles.defaults` there with whatever you want. * In the terminal fragments, add all your per-machine profiles. So here you'd add your WSL's, your various different workspaces, etc. So the one you're putting in the normal settings file is only the things that'll work on every machine. (Maybe I'm still misunderstanding though ☺️)
Author
Owner

@rbanffy commented on GitHub (Dec 9, 2021):

That was the idea. Should we consider something like this as the default
behavior or would it cascade into changes to other unrelated programs such
as the wsl.exe install system?

@rbanffy commented on GitHub (Dec 9, 2021): That was the idea. Should we consider something like this as the default behavior or would it cascade into changes to other unrelated programs such as the wsl.exe install system?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#16074