Closed Mystic8b closed 3 years ago
I'm sorry, which GUID? The GUID of the distro itself in the registry, or the GUID for the profile for the WSL distro?
I'm not sure I can help you on the first one. The second I might be able to help, but I think I'll need a little more background info on your scenario first.
I need a GUID for a profile in the terminal config. I found information on the Internet where to find the distribution's GUID in the registry, but it is completely different from the GUID in the config. I'm building a workspace through ansible and using the template module I want to load the prepared config. First, there will be tasks for finding installed distributions (I'll think of something with poweshell), and after that, depending on the distributions found, the config with the necessary content will be loaded. And also, before loading the config, I need to find the GUID of each of the distributions in order to set its value for the variable. I have not the most beautiful idea - to try to find the GUID in the existing config, and then replace it. But I think this is a very crooked solution and I would like something better. I would really appreciate your help. I'm not the only one looking for such information on the Internet, so I think you will help not only me with this.
It sounds to me like the easiest solution would probably be to just not use the existing profiles at all, and just define your own WSL profiles. Basically the only thing the dynamic generator for WSL does is create a bunch of profiles like:
{
"name": "Ubuntu",
"commandline": "wsl.exe -d Ubuntu"
},
If you absolutely needed to use the existing ones, you can usually just use the name
wherever you want to use the guid
. (Usually, the name
is more user-friendly than the guid
). So wt -p Ubuntu
will launch the Ubuntu distro, without needing to know the actual GUID of Ubuntu
I would like to change the Name
value. In this case, if I understand correctly, I can generate a new GUID (or it is not necessary) and add the distribution using the commandline
parameter.
I tried it like this:
"profiles":
{
"defaults":
{
"colorScheme": "Mystic Darkness",
"fontFace": "MesloLGS NF",
"fontSize": 9,
"cursorShape": "vintage",
"suppressApplicationTitle": true,
"historySize": 9001
},
"list":
[
{
// WSL Ubuntu
"name": "WSL Ubuntu",
//"guid": "{2c4de342-38b7-51cf-b940-2309a097f518}",
"guid": "{434e445e-4f2a-5b96-ac1e-a2962a402336}",
"commandline": "wsl.exe -d Ubuntu",
"icon": "C:\\Users\\Mystic\\OneDrive\\Программное обеспечение\\Resources\\Icons\\Terminal\\ubuntu.png",
"tabColor": "#dd4814",
//"cursorColor": "#e06b26",
"useAcrylic": true,
"acrylicOpacity" : 0.8,
"source": "Windows.Terminal.Wsl",
"startingDirectory": "//wsl$/Ubuntu/home/mystic"
},
But for some reason after that the tabColor
parameter stopped working (the color became black instead of orange) and useAcrylic
does not work. Am I doing something wrong?
And the icon is not displayed either. Everything broke)
upd None of the parameters work except the global ones
I figured out what's the matter, the ubuntu profile is re-created automatically. And it will do it anyway if no GUID is specified. Problem)
And I also caught an epic glitch, now I'm going to record a video.
upd That's what I did, it can only be solved by restarting the PC
This problem is due to the fact that I forgot to remove"commandline": "wt -p Ubuntu"
after trying to change the config.
This is definitely a mistake I made, but you might want to know about it.
This is the config to reproduce:
{
// WSL Ubuntu ans
"name": "Ubuntu",
"guid": "{2c4de342-38b7-51cf-b940-2309a097f518}",
//"guid": "{434e445e-4f2a-5b96-ac1e-a2962a402336}",
"commandline": "wt -p Ubuntu",
"icon": "C:\\Users\\Mystic\\OneDrive\\Программное обеспечение\\Resources\\Icons\\Terminal\\ubuntu.png",
"tabColor": "#dd4814",
//"cursorColor": "#e06b26",
"useAcrylic": true,
"acrylicOpacity" : 0.8,
"source": "Windows.Terminal.Wsl",
"startingDirectory": "//wsl$/Ubuntu/home/mystic"
},
Terminal Preview 1.5.3242.0
@Mystic8b - not sure if it is applicable, but probably it will still be simpler to do what @zadjii-msft suggested:
Guess will require some scripting on top of ansible, but it looks you are already open for adventures :blush:
I tried to hide it with hidden
without deleting it, but it didn't bring any results. As in the example above - no profile settings are applied (tabcolor, icon, acrylic
, etc).
Current cfg:
"profiles":
{
"defaults":
{
"colorScheme": "Mystic Darkness",
"fontFace": "MesloLGS NF",
"fontSize": 9,
"cursorShape": "vintage",
"suppressApplicationTitle": true,
"historySize": 9001
},
"list":
[
{
// WSL Ubuntu ans
"name": "Ubuntu",
"guid": "{fd386a5b-3b2d-478d-9d35-00b851c803c7}",
"commandline": "wt -p Ubuntu",
"icon": "C:\\Users\\Mystic\\OneDrive\\Программное обеспечение\\Resources\\Icons\\Terminal\\ubuntu.png",
"tabColor": "#dd4814",
"useAcrylic": true,
"acrylicOpacity" : 0.8,
"source": "Windows.Terminal.Wsl",
"startingDirectory": "//wsl$/Ubuntu/home/mystic"
},
{
"guid": "{2c4de342-38b7-51cf-b940-2309a097f518}",
"name": "Ubuntu",
"source": "Windows.Terminal.Wsl",
"hidden": true
}
The automatically generated profile GUID is always the same, it looks like it's stored somewhere. I expected everything to be easier)
@Mystic8b - you shouldn't put source field in custom profile. It makes it's properties skipped
I tried deleting source
, it doesn't change anything
@Mystic8b - I guess it doesn't work because you are spawning a new terminal in your commandline
. I guess the spawned terminal uses the second "Ubuntu" profile, otherwise I am not sure how it doesn't enter an endless loop ( profile spawning a new terminal with itself) 🤔
Consider changing it to something like
wsl -d Ubuntu
The following config absolutely makes my tab very orange. Please try:
{
// WSL Ubuntu ans
"name": "My Ubuntu",
"guid": "{fd386a5b-3b2d-478d-9d35-00b851c803c7}",
"commandline": "wsl -d Ubuntu",
"tabColor": "#dd4814",
"useAcrylic": true,
"acrylicOpacity" : 0.8
}
hm, nope...
ps I noticed an error in the startingDirectory
parameter for WSL Debian, the path is Ubuntu, but for some reason it worked)
hm, nope...
ps I noticed an error in the
startingDirectory
parameter for WSL Debian, the path is Ubuntu, but for some reason it worked)
Well.. this is weird. Tested in both 1.4 and 1.5:
What version are you using?
Last preview: 1.5.3242.0
At the bottom of the code above, everything is still present:
{
"guid": "{2c4de342-38b7-51cf-b940-2309a097f518}",
"hidden": true,
"name": "Ubuntu",
"source": "Windows.Terminal.Wsl"
}
oooh it's my mistake) sorry, the default GUID didn't change ... Everything works! Excellent! My regards! Thanks for your time friends!
Stop, but I need to know the GUID to make it hidden, anyway...
Stop, but I need to know the GUID to make it hidden, anyway...
Only auto-generated profiles have "source" field. Cannot you simply add "hidden" to profiles that have "source"? I mean, you will need to iterate through profiles with a script :blush:
I will not modify the existing one, but replace the config. Different conditions will be written in the config template itself. This is where the problem is. Modifying only the wsl profile is not a problem, but there will be too many changes in the config, it will be either too difficult or impossible to do.
I will not modify the existing one, but replace the config. Different conditions will be written in the config template itself. This is where the problem is. Modifying only the wsl profile is not a problem, but there will be too many changes in the config, it will be either too difficult or impossible to do.
I see... achieving this with template can be hard-core. I thought more of ansible invoking a script that modifies the config, post-installation.
I see that in the code there is a property called disabledProfileSources
that looks to prevent the generation of profiles.
Update: I see it is documented here
This will allow you to disable the profile generation and create your custom one instead.
Victory!) It works! I didn’t even think about looking for an option to turn off profile auto-generation. Thanks again!
Victory!) It works! I didn’t even think about looking for an option to turn off profile auto-generation. Thanks again!
Cool! I didn't think about this either (could save us some time) :blush:
I guess this was the original intention of the team: whoever wants to do something automated just disable dynamic profiles and template everything by your own!
Good luck 💪
Can you please tell me how to get the GUID for a specific wsl distribution? It is generated automatically, but the problem is that I build through ansible and I need to find out the GUID of the distribution before deploying the config.