Parameterizable dynamic profiles #7699

Open
opened 2026-01-31 01:10:41 +00:00 by claunia · 4 comments
Owner

Originally created by @letmaik on GitHub (Apr 25, 2020).

Description of the new feature/enhancement

Eventually the plugin system will allow to contribute new dynamic profiles. I think it would be useful if there was a way to parameterize dynamic profiles. Currently, the automatically provided "commandline" has to be overridden to customize anything. I think this breaks abstraction/layering/encapsulation/... and often there would be no need for it if dynamic profile providers become smarter. See examples below. If the community can't come up with more use cases then it's not worth the effort obviously. This issue is about collecting ideas and opinions.

Proposed technical implementation details (optional)

Instead of:

            {
                "guid": "{f9679c4b-7da6-409d-a372-86ebe9127f2a}",
                "commandline" : "powershell.exe -ExecutionPolicy ByPass -NoExit -Command \"& '%USERPROFILE%\\Miniconda3\\shell\\condabin\\conda-hook.ps1' ; conda activate tensorflow\"",
                "icon" : "%USERPROFILE%/Miniconda3/Menu/Iconleak-Atrous-PSConsole.ico",
                "name" : "Miniconda (tensorflow)"
            }

I'd like:

            {
                "guid": "{f9679c4b-7da6-409d-a372-86ebe9127f2a}",
                "source": "Continuum.Miniconda3",
                "name" : "Miniconda (tensorflow)",
                "options": {
                  "env": "tensorflow", // defaults to "base"
                  "shell": "powershell" // or "cmd"
                }
            }

Instead of:

            {
                "guid": "{574e775e-4f2a-5b96-ac1e-a2962a402336}",
                "hidden": false,
                "name": "PowerShell",
                "source": "Windows.Terminal.PowershellCore",
                "commandline": "C:\\Program Files\\PowerShell\\6\\pwsh.exe --NoLogo"  
            }

I'd like:

            {
                "guid": "{574e775e-4f2a-5b96-ac1e-a2962a402336}",
                "hidden": false,
                "name": "PowerShell",
                "source": "Windows.Terminal.PowershellCore",
                "options": {
                  "nologo": true
                }
            }
Originally created by @letmaik on GitHub (Apr 25, 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). --> Eventually the plugin system will allow to contribute new dynamic profiles. I think it would be useful if there was a way to parameterize dynamic profiles. Currently, the automatically provided `"commandline"` has to be overridden to customize anything. I think this breaks abstraction/layering/encapsulation/... and often there would be no need for it if dynamic profile providers become smarter. See examples below. If the community can't come up with more use cases then it's not worth the effort obviously. This issue is about collecting ideas and opinions. # Proposed technical implementation details (optional) Instead of: ```json { "guid": "{f9679c4b-7da6-409d-a372-86ebe9127f2a}", "commandline" : "powershell.exe -ExecutionPolicy ByPass -NoExit -Command \"& '%USERPROFILE%\\Miniconda3\\shell\\condabin\\conda-hook.ps1' ; conda activate tensorflow\"", "icon" : "%USERPROFILE%/Miniconda3/Menu/Iconleak-Atrous-PSConsole.ico", "name" : "Miniconda (tensorflow)" } ``` I'd like: ```json { "guid": "{f9679c4b-7da6-409d-a372-86ebe9127f2a}", "source": "Continuum.Miniconda3", "name" : "Miniconda (tensorflow)", "options": { "env": "tensorflow", // defaults to "base" "shell": "powershell" // or "cmd" } } ``` Instead of: ```json { "guid": "{574e775e-4f2a-5b96-ac1e-a2962a402336}", "hidden": false, "name": "PowerShell", "source": "Windows.Terminal.PowershellCore", "commandline": "C:\\Program Files\\PowerShell\\6\\pwsh.exe --NoLogo" } ``` I'd like: ```json { "guid": "{574e775e-4f2a-5b96-ac1e-a2962a402336}", "hidden": false, "name": "PowerShell", "source": "Windows.Terminal.PowershellCore", "options": { "nologo": true } } ```
claunia added the Issue-FeatureArea-SettingsProduct-TerminalArea-Commandline labels 2026-01-31 01:10:41 +00:00
Author
Owner

@jdhitsolutions commented on GitHub (May 1, 2020):

I agree it might be nice to separate command-line arguments, from the command line. Although I'd probably opt for something like:

  {
                "commandline": "powershell.exe",
                "arguments" : "-nologo -noprofile",
                "guid": "{ca3da2bd-de18-40f7-9fc6-234345d1e89f}",
                "icon": "ms-appx:///ProfileIcons/{61c54bbd-c2c6-5271-96e7-009a87ff44bf}.png",
                "name": "Windows PowerShell No Profile",
                "tabTitle": "PS No Profile",
                "useAcrylic": true
            }

Taking this a step further I can envision a scenario launching a profile with WT.exe and specifying dynamic arguments.

@jdhitsolutions commented on GitHub (May 1, 2020): I agree it might be nice to separate command-line arguments, from the command line. Although I'd probably opt for something like: ```json { "commandline": "powershell.exe", "arguments" : "-nologo -noprofile", "guid": "{ca3da2bd-de18-40f7-9fc6-234345d1e89f}", "icon": "ms-appx:///ProfileIcons/{61c54bbd-c2c6-5271-96e7-009a87ff44bf}.png", "name": "Windows PowerShell No Profile", "tabTitle": "PS No Profile", "useAcrylic": true } ``` Taking this a step further I can envision a scenario launching a profile with WT.exe and specifying dynamic arguments.
Author
Owner

@DHowett-MSFT commented on GitHub (May 1, 2020):

Yeah, we should definitely have a story for this. I'm a bit scarred by Docker's ENTRYPOINT versus CMD nonsense, but it makes some amount of sense. If you set the entrypoint/command properly, docker run containerapp becomes a stand-in for app, because it passes all of its arguments to app internally. It makes sense.

It'll take work to comport all these things, and no small amount of design (to make sure it keeps working for everyone), but I love the idea of wt -p PSCore -nologo test.ps1.

@DHowett-MSFT commented on GitHub (May 1, 2020): Yeah, we should definitely have a story for this. I'm a bit scarred by Docker's `ENTRYPOINT` versus `CMD` nonsense, but it makes some amount of sense. If you set the entrypoint/command properly, `docker run containerapp` becomes a stand-in for `app`, because it passes all of its arguments to `app` internally. It makes sense. It'll take work to comport all these things, and no small amount of design (to make sure it keeps working for everyone), but I love the idea of `wt -p PSCore -nologo test.ps1`.
Author
Owner

@letmaik commented on GitHub (May 1, 2020):

Yeah, I agree with you guys that just using extra arguments might be more sensible. And if for some reason this wouldn't work because the thing to customize appears in weird places, then one could always write a wrapper script that makes it nice again.

@letmaik commented on GitHub (May 1, 2020): Yeah, I agree with you guys that just using extra arguments might be more sensible. And if for some reason this wouldn't work because the thing to customize appears in weird places, then one could always write a wrapper script that makes it nice again.
Author
Owner

@TBBle commented on GitHub (May 2, 2021):

Just came across another user-story for this (or at least, I think it's this) which is customising parts of the profile other than the command line.

Per https://github.com/microsoft/terminal/issues/1669#issuecomment-830732471, my current full-coverage MSYS2 set of profiles look like

      {
        "guid": "{c1372a71-8d9f-49d7-99db-8cb284c50b98}",
        //"commandline": "\"C:/msys64/msys2_shell.cmd\" -defterm -no-start -msys2",
        "commandline": "C:/msys64/usr/bin/env.exe MSYS='enable_pcon winsymlinks:nativestrict' CHERE_INVOKING=1 MSYSTEM=MSYS /bin/bash --login",
        "icon": "C:/msys64/msys2.ico",
        "name": "MSYS2 MSYS"
      },
      {
        "guid": "{2367860f-e6b6-4e91-821a-287e0cceee71}",
        //"commandline": "\"C:/msys64/msys2_shell.cmd\" -defterm -no-start -mingw64",
        "commandline": "C:/msys64/usr/bin/env.exe MSYS='enable_pcon winsymlinks:nativestrict' CHERE_INVOKING=1 MSYSTEM=MINGW64 /bin/bash --login",
        "icon": "C:/msys64/mingw64.ico",
        "name": "MSYS2 MinGW 64-bit"
      },
      {
        "guid": "{098bcacf-f271-4b79-b6c3-315bb4240e54}",
        //"commandline": "\"C:/msys64/msys2_shell.cmd\" -defterm -no-start -mingw32",
        "commandline": "C:/msys64/usr/bin/env.exe MSYS='enable_pcon winsymlinks:nativestrict' CHERE_INVOKING=1 MSYSTEM=MINGW32 /bin/bash --login",
        "icon": "C:/msys64/mingw32.ico",
        "name": "MSYS2 MinGW 32-bit"
      },
      {
        "guid": "{20ca76e4-8d6f-4d37-8468-dbf02385dd18}",
        //"commandline": "\"C:/msys64/msys2_shell.cmd\" -defterm -no-start -ucrt64",
        "commandline": "C:/msys64/usr/bin/env.exe MSYS='enable_pcon winsymlinks:nativestrict' CHERE_INVOKING=1 MSYSTEM=UCRT64 /bin/bash --login",
        "icon": "C:/msys64/ucrt64.ico",
        "name": "MSYS2 UCRT 64-bit"
      },
      {
        "guid": "{87536769-301c-4fee-89c9-c1aa8950e471}",
        //"commandline": "\"C:/msys64/msys2_shell.cmd\" -defterm -no-start -clang64",
        "commandline": "C:/msys64/usr/bin/env.exe MSYS='enable_pcon winsymlinks:nativestrict' CHERE_INVOKING=1 MSYSTEM=CLANG64 /bin/bash --login",
        "icon": "C:/msys64/clang64.ico",
        "name": "MSYS2 Clang 64-bit"
      },

Apart from the name, they are all varying only in the value of the MSYSTEM env-var (included in the icon name), so once we have a dynamic profile generator for MSYS2, it'd be nice to be able to do something like

            {
                "guid": "{87536769-301c-4fee-89c9-c1aa8950e471}",
                "name": "MSYS2 Clang 64-bit",
                "source": "Some.Plugin.Profiles.MSYS2",
                "options": {
                  "msystem": "clang64" # Default is msys2
                }
            }

although in this case it's likely to be adding profiles (you would still keep the msys2 profile around for pacman, I expect), so given it's a closed set, perhaps this is not actually a good use-case for customisation, as the generator could generate all the profiles, and users can just enable/disable as they see fit.

The MSYS env-var might be a good use-case for customisation though, since that's used to hold a bunch of toggles. A dynamic profile generator (and given #2785 so we don't need to use env to set env-vars, which won't work with the "append command line args" proposal because that will affect the program's arguments, not env's arguments) might want to honour the <MSYSTEM>.ini file though, rather than exposing these via Windows Terminal.

So yeah, MSYS2 wouldn't need the functionality here, but it does illustrate a non-command-line use-case.

@TBBle commented on GitHub (May 2, 2021): Just came across another user-story for this (or at least, I think it's this) which is customising parts of the profile other than the command line. Per https://github.com/microsoft/terminal/issues/1669#issuecomment-830732471, my current full-coverage MSYS2 set of profiles look like ```jsonc { "guid": "{c1372a71-8d9f-49d7-99db-8cb284c50b98}", //"commandline": "\"C:/msys64/msys2_shell.cmd\" -defterm -no-start -msys2", "commandline": "C:/msys64/usr/bin/env.exe MSYS='enable_pcon winsymlinks:nativestrict' CHERE_INVOKING=1 MSYSTEM=MSYS /bin/bash --login", "icon": "C:/msys64/msys2.ico", "name": "MSYS2 MSYS" }, { "guid": "{2367860f-e6b6-4e91-821a-287e0cceee71}", //"commandline": "\"C:/msys64/msys2_shell.cmd\" -defterm -no-start -mingw64", "commandline": "C:/msys64/usr/bin/env.exe MSYS='enable_pcon winsymlinks:nativestrict' CHERE_INVOKING=1 MSYSTEM=MINGW64 /bin/bash --login", "icon": "C:/msys64/mingw64.ico", "name": "MSYS2 MinGW 64-bit" }, { "guid": "{098bcacf-f271-4b79-b6c3-315bb4240e54}", //"commandline": "\"C:/msys64/msys2_shell.cmd\" -defterm -no-start -mingw32", "commandline": "C:/msys64/usr/bin/env.exe MSYS='enable_pcon winsymlinks:nativestrict' CHERE_INVOKING=1 MSYSTEM=MINGW32 /bin/bash --login", "icon": "C:/msys64/mingw32.ico", "name": "MSYS2 MinGW 32-bit" }, { "guid": "{20ca76e4-8d6f-4d37-8468-dbf02385dd18}", //"commandline": "\"C:/msys64/msys2_shell.cmd\" -defterm -no-start -ucrt64", "commandline": "C:/msys64/usr/bin/env.exe MSYS='enable_pcon winsymlinks:nativestrict' CHERE_INVOKING=1 MSYSTEM=UCRT64 /bin/bash --login", "icon": "C:/msys64/ucrt64.ico", "name": "MSYS2 UCRT 64-bit" }, { "guid": "{87536769-301c-4fee-89c9-c1aa8950e471}", //"commandline": "\"C:/msys64/msys2_shell.cmd\" -defterm -no-start -clang64", "commandline": "C:/msys64/usr/bin/env.exe MSYS='enable_pcon winsymlinks:nativestrict' CHERE_INVOKING=1 MSYSTEM=CLANG64 /bin/bash --login", "icon": "C:/msys64/clang64.ico", "name": "MSYS2 Clang 64-bit" }, ``` Apart from the name, they are all varying only in the value of the `MSYSTEM` env-var (included in the icon name), so once we have a dynamic profile generator for MSYS2, it'd be nice to be able to do something like ```jsonc { "guid": "{87536769-301c-4fee-89c9-c1aa8950e471}", "name": "MSYS2 Clang 64-bit", "source": "Some.Plugin.Profiles.MSYS2", "options": { "msystem": "clang64" # Default is msys2 } } ``` although in this case it's likely to be _adding_ profiles (you would still keep the msys2 profile around for `pacman`, I expect), so given it's a closed set, perhaps this is not actually a good use-case for customisation, as the generator could generate all the profiles, and users can just enable/disable as they see fit. The `MSYS` env-var might be a good use-case for customisation though, since that's used to hold a bunch of toggles. A dynamic profile generator (and given #2785 so we don't need to use `env` to set env-vars, which won't work with the "append command line args" proposal because that will affect the program's arguments, not env's arguments) might want to honour the `<MSYSTEM>.ini` file though, rather than exposing these via Windows Terminal. So yeah, MSYS2 wouldn't _need_ the functionality here, but it does illustrate a non-command-line use-case.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#7699