Last week I shared some PowerShell code I had been using to manage different aspects of Windows Terminal. I also had posted a script to backup my Windows Terminal settings file. With all that code, plus other ideas brewing, it only made sense to bundle everything together into a PowerShell module. The module, WTToolBox should run on Windows systems under Windows PowerShell 5.1 or PowerShell 7. I'm assuming you also have Windows Terminal installed. If you import the module and don't have Windows Terminal installed you'll get an warning message. You can install the module from the PowerShell Gallery.
ManageEngine ADManager Plus - Download Free Trial
Exclusive offer on ADManager Plus for US and UK regions. Claim now!
Install-Module WTToolBox
The module's repository is at https://github.com/jdhitsolutions/WTToolbox. You are encourgaged to take a few minutes to look at the README file.
WT Variables
One of the main additions is that when you import the module, it will create global variables.
The variables make it easier to see what is in the defaults.json file and your settings.json file. The latter variable, $WTSettings, has been customized with additional features.
It will show the computer name, the date the settings.json file was last updated and when the object was refreshed. If you make a change to settings.json, you can refresh this object.
$wtsettings.refresh()
I find these objects handy when I want to check things without having to open files.
WT Keybindings
The other addition to the module is an easy way to see key bindings. The Get-WTKeybinding command will go through the defaults.json and settings.json file to create a set of custom objects that show you your Windows Terminal keybindings. If you have a keybinding in settings.json that replaces a key combo in defaults.json, your setting takes precedence.
I'm bending best practices a bit with this command. Normally, functions should do one thing and write one type of object to the pipeline. And by default that is what this command does. But I added a -Format parameter that will let you format the results as a list, table or send to Out-Gridview.
The formatted output groups key bindings by source, i.e. default or settings. Yes, you could have done the same thing, but I wrote this thinking some people might run it who aren't really PowerShell users.
I hope you'll give the module a try and let me know what you think. Please post problems or suggestions in the GitHub Issues section of the module's repository.
3 thoughts on “A PowerShell Windows Terminal Toolbox”
Comments are closed.