Refresh profiles.json on load #7362

Closed
opened 2026-01-31 01:01:59 +00:00 by claunia · 4 comments
Owner

Originally created by @Conner05 on GitHub (Apr 10, 2020).

Description of the new feature/enhancement

Today when I download a new shell I have to either manually add the config to profiles.json or I have to do what @shanselman suggests in his blog post Now Is The Time To Make A Fresh New Windows Terminal profiles.json.

This behavior is certainly not intuitive. Adding the ability to fetch new shells on startup would fix this weirdness.

Proposed technical implementation details (optional)

// on start
// make backup of current profiles.json in case below fails
// get all current shells
// get all shells referenced in profiles.json
// generate a new profiles.json
// add shells that do not exist
// save new profiles.json
// delete backup
Originally created by @Conner05 on GitHub (Apr 10, 2020). <!-- 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨 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! --> # Description of the new feature/enhancement <!-- A clear and concise description of what the problem is that the new feature would solve. Describe why and how a user would use this new functionality (if applicable). --> Today when I download a new shell I have to either manually add the config to `profiles.json` or I have to do what @shanselman suggests in his blog post [Now Is The Time To Make A Fresh New Windows Terminal profiles.json](https://www.hanselman.com/blog/NowIsTheTimeToMakeAFreshNewWindowsTerminalProfilesjson.aspx). This behavior is certainly not intuitive. Adding the ability to fetch new shells on startup would fix this weirdness. # Proposed technical implementation details (optional) <!-- A clear and concise description of what you want to happen. --> ``` // on start // make backup of current profiles.json in case below fails // get all current shells // get all shells referenced in profiles.json // generate a new profiles.json // add shells that do not exist // save new profiles.json // delete backup ```
Author
Owner

@zadjii-msft commented on GitHub (Apr 10, 2020):

How do you propose we "get all the current shells"? SHould we enumerate all filesystem files to look for new commandline applications that are installed? What constitutes a shell?

We already have support for "dynamic profiles" and generate profiles dynamically for WSL and powershell core installs.

What shell are you installing that we don't dynamically generate?

@zadjii-msft commented on GitHub (Apr 10, 2020): How do you propose we "get all the current shells"? SHould we enumerate all filesystem files to look for new commandline applications that are installed? What constitutes a shell? We already have support for "dynamic profiles" and generate profiles dynamically for WSL and powershell core installs. What shell are you installing that we don't dynamically generate?
Author
Owner

@Conner05 commented on GitHub (Apr 10, 2020):

@zadjii-msft I would propose it be done the same way it sources them now. When I follow Scott's blog post and empty the profiles.json file and save it, it refreshes and gives me all the shells I've installed.

What constitutes a shell? Anything the Terminal would normally add to the profiles.json file when it generates. I am not suggesting anything change there.

I am not familiar with "dynamic profiles". All I know is I first installed the Windows Terminal from the Microsoft Store then installed Ubuntu from the Store. After that, I didn't see it listed in my profiles.json. I had to go digging on the internet how to get it into the profiles.json file. I found this article. I installed Debian to see if it was a fluke, but sure enough it didn't get added to my profiles.json either. However, after doing what Scott suggested my Debian profile section got added. What I'm suggesting is that process of refreshing the profiles.json be expanded to not replace, but add any new shells detected on restart of the Terminal.

I hope that makes sense. I'll have to look into "dynamic profiles", though.

@Conner05 commented on GitHub (Apr 10, 2020): @zadjii-msft I would propose it be done the same way it sources them now. When I follow Scott's blog post and empty the profiles.json file and save it, it refreshes and gives me all the shells I've installed. What constitutes a shell? Anything the Terminal would normally add to the profiles.json file when it generates. I am not suggesting anything change there. I am not familiar with "dynamic profiles". All I know is I first installed the Windows Terminal from the Microsoft Store then installed Ubuntu from the Store. After that, I didn't see it listed in my profiles.json. I had to go digging on the internet how to get it into the profiles.json file. I found [this article](https://windowsloop.com/add-ubuntu-to-windows-terminal/). I installed Debian to see if it was a fluke, but sure enough it didn't get added to my profiles.json either. However, after doing what Scott suggested my Debian profile section got added. What I'm suggesting is that process of refreshing the profiles.json be expanded to not replace, but add any new shells detected on restart of the Terminal. I hope that makes sense. I'll have to look into "dynamic profiles", though.
Author
Owner

@Conner05 commented on GitHub (Apr 10, 2020):

Dynamic Profiles does exactly this. I somehow overlooked it.

@Conner05 commented on GitHub (Apr 10, 2020): Dynamic Profiles does exactly this. I somehow overlooked it.
Author
Owner

@zadjii-msft commented on GitHub (Apr 10, 2020):

That's actually how the Windows Terminal actually works today. There are some details in this doc, and far more details in here.

I'm not sure why this wasn't working for you - we're seeing some intermittent reports that our timeout to enumerate all the user's WSL distros might not be long enough, in which case we won't display the WSL profiles, but otherwise this should happen on each Terminal launch.

@zadjii-msft commented on GitHub (Apr 10, 2020): That's actually how the Windows Terminal actually works today. There are some details in [this doc](https://github.com/microsoft/terminal/blob/master/doc/user-docs/UsingJsonSettings.md#dynamic-profiles), and far more details in [here](https://github.com/microsoft/terminal/blob/master/doc/specs/%23754%20-%20Cascading%20Default%20Settings.md). I'm not sure why this wasn't working for you - we're seeing some intermittent reports that our timeout to enumerate all the user's WSL distros might not be long enough, in which case we won't display the WSL profiles, but otherwise this should happen on each Terminal launch.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#7362