Scott Hanselman

The Windows Terminal made better with the Command Palette plus Multiple Actions in one Command

March 23, 2021 Comment on this post [14] Posted in Open Source | Win10
Sponsored By

I thought I knew everything about the open source Windows Terminal and then I hit Ctrl+Shift+P like I do in VS Code (muscle memory) and it pops up a lovely Command Palette. You can search for any command and see the current keybinding. Super useful if you haven't yet discovered Window Panes. You can also type new wt.exe command lines and affect the current window.

NOTE: Don't forget, "wt" is an alias for the Windows Terminal, so you can Win+R and type wt and run it!

You can create your own commands and even nest them in the Palette! You can even iterate over other objects/profiles in your settings and dynamically create commands!

Since the wt.exe allows for chained commands, I can create a custom command in settings that calls wt.exe with chained commands/actions and bingo, I have a command called Development that opens multiple profiles, splits the screen and sets me up for Windows+Linux development in a single move!

Here I have a new command called Development that calls wt with a new-tab with a named profile, then a split-pane with another named profile.

"keybindings": 
[

{
"command":
{
"action": "wt",
"commandline": "new-tab -p \"Powershell\" ; split-pane -p \"Ubuntu-18.04\""
},
"name": "Development"
},
...

Here's the result!

Split screen

Oh, and by the way, you can also apply Shaders to the Windows Terminal...in real time! So that's AWESOME.

CRT Effect!

Have fun! Thanks to Kayla for her help on this post!


Sponsor: The No. 1 reason developers choose Couchbase? You can use your existing SQL++ skills to easily query and access JSON. That’s more power and flexibility with less training. Learn more.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Hosting By
Hosted in an Azure App Service
March 26, 2021 15:18
Hi Scott,
This is very useful! But is there any, official, reference on what we can actually use in "commandline" JSON property and in which way. Because some of the commands, like splitPane have some arguments for the direction of the split and I found it in
here

Thanks in advance
March 26, 2021 15:47
I love wt, but I don't really need split panels, so I was planning to just skim this blog post... I figured I'd hit CTRL-SHIFT-P just to see what unnecessary stuff was there and my eyes went to "Find".

Just CTRL-SHIFT-F to "Find"... in the console?!?

OK, I'm sold. Getting a fresh coffee, then I'm going to look closer at the wt options.
March 26, 2021 16:04
The only issue with shaders is it doesn't honour font transparency, so you get the background-colour ghosting problem :-(
March 26, 2021 17:57
Hello Adam, most probably we are going to see this feature as well in the upcoming updates from Microsoft. Let's hope for the best.
March 26, 2021 19:08
Does anyone know how to paste multiline string from e.g. Notepad++ into the Windows terminal as one multiline command and not multiple one line commands?
Jan
March 26, 2021 19:47
When I hit Win+R then type wt it opens up my old windows terminal not the preview one I use. how do i make the preview on my default terminal?
March 26, 2021 22:14
Hello Sphelele, the default wt.exe is stored here:
c:\users\the-user-account\AppData\Local\Microsoft\WindowsApps\wt.exe

If you have both the normal and preview releases installed, then you will have 2 folders beneath this folder Microsoft.WindowsTerminal_8wekyb3d8bbwe and Microsoft.WindowsTerminalPreview_8wekyb3d8bbwe. They both have a wt.exe in this folder. For it to work with Win + X - copy the preview wt.exe into the top level folder - finished.

This should also make this version the default when launching from Win + R or from a command prompt.
March 27, 2021 1:10
You can also go to the "Alias" settings (type Alias at Start) and turn off wt for the main terminal and turn it on for Preview!
March 29, 2021 1:31
Scott -- one of my favorite short cuts is entering "cmd" into the address bar of file explorer and pressing enter. A cmd terminal window is then opened with the current directory set to that of explorer. Is there a way to do that with "wt"?? Is the "cmd" trick an explorer feature, or a lower level happy coincidence? Thanks or all your help highlighting the feature of Windows
March 30, 2021 11:44
This is aweseome stuff. My goal is to be able to type in my project name, and have it bring up 2 panes, one for the server code and one for the client code. Your example has got me with two Powershell panes, but is there a way I can get each of them to be in a specific folder?
March 30, 2021 12:06
Nevermind. I worked it out.

{ "command": {
"action": "wt",
"commandline": "new-tab -p \"Powershell\" -d c:\\SourceCode\\MyServerCode ; split-pane -p \"Powershell\" -d c:\\SourceCode\\MyClientCode"
},
"name": "IMS"
},
March 30, 2021 19:15
ok but what is that heart icon?? Is that ohmyposh?
April 01, 2021 20:20
Scott... Alias Settings? What am I missing? 'Type Alias at Start'? Can you expand?
I have struggled having both Preview and Default installed and switching between them.
April 01, 2021 20:24
Thanks Scott, for the info about open source Windows Terminal.

Comments are closed.

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.