terminal icon indicating copy to clipboard operation
terminal copied to clipboard

Refresh profiles.json on load

Open Conner05 opened this issue 6 years ago • 4 comments

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

Conner05 avatar Apr 10 '20 14:04 Conner05

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 avatar Apr 10 '20 15:04 zadjii-msft

@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 avatar Apr 10 '20 16:04 Conner05

Dynamic Profiles does exactly this. I somehow overlooked it.

Conner05 avatar Apr 10 '20 16:04 Conner05

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 avatar Apr 10 '20 16:04 zadjii-msft