Profile start and end commands #9120

Closed
opened 2026-01-31 01:46:35 +00:00 by claunia · 2 comments
Owner

Originally created by @jthoward64 on GitHub (Jun 18, 2020).

Description of the new feature

In my case it's starting/ending a headless virtual machine before ssh-ing into it, but there are a number of cases where opening a particular profile can have prerequisite commands before being useful. I suggest that new profile options be added to automate running a command when a profile is opened and when that profile is closed. An additional suggestion would be a setting to determine if these commands are run per tab or per profile, otherwise a field for each.

Proposed technical implementation details

  1. The user opens windows terminal
  2. The user opens a profile with all of these options set
  3. Once the profile is opened the on-open command(s) are automatically run (à la .bashrc)
  4. The user opens another tab and if the user has set per-tab commands, windows terminal runs those
  5. The user closes these tabs and the on-close command(s) are run.
Originally created by @jthoward64 on GitHub (Jun 18, 2020). # Description of the new feature In my case it's starting/ending a headless virtual machine before ssh-ing into it, but there are a number of cases where opening a particular profile can have prerequisite commands before being useful. I suggest that new profile options be added to automate running a command when a profile is opened and when that profile is closed. An additional suggestion would be a setting to determine if these commands are run per tab or per profile, otherwise a field for each. # Proposed technical implementation details 1. The user opens windows terminal 2. The user opens a profile with all of these options set 3. Once the profile is opened the on-open command(s) are automatically run (à la .bashrc) 4. The user opens another tab and if the user has set per-tab commands, windows terminal runs those 5. The user closes these tabs and the on-close command(s) are run.
claunia added the Issue-QuestionNeeds-Tag-FixResolution-Answered labels 2026-01-31 01:46:35 +00:00
Author
Owner

@intractabilis commented on GitHub (Jun 18, 2020):

Via what mechanism commands are issued? Windows Terminal just starts a process, it cannot tell this process what to do. For example, imagine "commandline": "doom_console", how Windows Terminal can tell doom_console to execute iddqd?

@intractabilis commented on GitHub (Jun 18, 2020): Via what mechanism commands are issued? Windows Terminal just starts a process, it cannot tell this process what to do. For example, imagine `"commandline": "doom_console"`, how Windows Terminal can tell `doom_console` to execute `iddqd`?
Author
Owner

@DHowett commented on GitHub (Jun 18, 2020):

Yeah, that's the thing I'm worried about. There's a bunch of different ways to do this for each different shell, and I think it's best left to the shell.

For PowerShell, you can...

powershell -noexit -c startup_thing ; powershell ; exit_thing

or just customize Profile.ps1

for bash, .bashrc and .bash_logout

for CMD,
don't use cmd, it is not good

This isn't something I'd like to get Terminal mired in figuring out. I'm gonna close this one out as "not terribly actionable" 😄 sorry!

@DHowett commented on GitHub (Jun 18, 2020): Yeah, that's the thing I'm worried about. There's a bunch of different ways to do this for each different shell, and I think it's best left to the _shell_. For PowerShell, you can... ``` powershell -noexit -c startup_thing ; powershell ; exit_thing ``` or just customize `Profile.ps1` for bash, `.bashrc` and `.bash_logout` for CMD, don't use cmd, it is not good This isn't something I'd like to get Terminal mired in figuring out. I'm gonna close this one out as "not terribly actionable" :smile: sorry!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#9120