『Windows』WindowsTerminal完全配置教程(主题以及启动设置)
『Windows』WindowsTerminal 完全配置教程(主题以及启动设置)
Windows Terminal 完全配置教程(主题以及启动设置)
一、安装 Windows terminal
Microsoft Store 搜索 Windows terminal
第一个和第二个都可以!!
二、选择主题
Windows terminal 提供了大量的主题可以选择,当然也可以像 VScode 文本编辑器一样自行配置。
登陆如下网址,选择一个你喜欢的主题复制主题代码
https://atomcorp.github.io/themes/
三、配置主题
打开 Windows terminal
Win+R 运行,输入 wt
点击 Windows terminal 中的下拉箭头选择设置,打开配置 Windows Terminal 的 Json 文件。
将复制的主题代码粘贴到在 list 中,分别配置 PowerShell 的主题和 cmd 的主题,添加刚才获得代码即可应用对应的主题。name 为标识,用于设置终端应用哪个主题。
我的主题配置如下:
// This file was initially generated by Windows Terminal Preview 1.5.3242.0
// It should still be usable in newer versions, but newer versions might have additional
// settings, help text, or changes that you will not see unless you clear this file
// and let us generate a new one for you.
// To view the default settings, hold "alt" while clicking on the "Settings" button.
// For documentation on these settings, see: https://aka.ms/terminal-documentation
{
"$schema": "https://aka.ms/terminal-profiles-schema",
"defaultProfile": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
// You can add more global application settings here.
// To learn more about global settings, visit https://aka.ms/terminal-global-settings
// If enabled, selections are automatically copied to your clipboard.
"copyOnSelect": false,
// If enabled, formatted data is also copied to your clipboard
"copyFormatting": false,
// A profile specifies a command to execute paired with information about how it should look and feel.
// Each one of them will appear in the 'New Tab' dropdown,
// and can be invoked from the commandline with `wt.exe -p xxx`
// To learn more about profiles, visit https://aka.ms/terminal-profile-settings
"profiles": {
"defaults": /*全局配置*/ {
// Put settings here that you want to apply to all profiles
// 默认打开的 Profile GUID(下面会详细介绍)
"defaultProfile": "{97838c1f-307b-477a-b7fe-c9965c347e0b}",
"startingDirectory": null,
// 终端窗口默认大小
"initialCols": 120,
"initialRows": 30,
// 亮色或暗色主题,可选值 "light", "dark", "system"
"requestedTheme": "system",
// 合并标题栏和标签栏
"showTabsInTitlebar": true,
// 如果 showTabsInTitlebar 与本值同为 false 时,自动隐藏标签栏
"alwaysShowTabs": true,
// 在标题栏上显示当前活动标签页的标题
"showTerminalTitleInTitlebar": true,
// 双击选择时用于分词的字符
"wordDelimiters": " /\\()\"'-.,:;<>~!@#$%^&*|+=[]{}~?\u2502",
// 选择时复制到剪贴板
"copyOnSelect": true,
// ...
},
"list": /*每种类型terminal的详细配置*/ [
{
// Make changes here to the cmd.exe profile 关于cmd的配置
"guid": "{97838c1f-307b-477a-b7fe-c9965c347e0b}",
/*网页搜索guid生成可以获得每个程序唯一的guid,visual studio内的工具也有生成guid的功能*/
"name": "CMD",
"commandline": "cmd.exe",
/*程序位置*/
"hidden": false,
"tabTitle": "CMD", /*名称*/
"foreground": "#DCDCDC", /*字体颜色*/
"icon": "C:/Users/ChiamZhang/Pictures/Saved Pictures/vz.jpeg", /*ICO图标*/
"backgroundImage": "C:/Users/ChiamZhang/Pictures/Saved Pictures/back.jpg", /*终端背景图*/
"acrylicOpacity": 0.95,
/*亚克力透明效果*/
"backgroundImageOpacity": 0.70,
/*背景透明度*/
"backgroundImageStretchMode": "fill",
"closeOnExit": true,
"colorScheme": "Campbell",
"cursorColor": "#FFFFFF",
"cursorShape": "bar",
"fontFace": "Consoles",
"fontSize": 12,
"historySize": 9001,
"padding": "0, 0, 0, 0",
"snapOnInput": true,
"startingDirectory": "%USERPROFILE%",
"useAcrylic": true
},
{
// Make changes here to the powershell.exe profile
"guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
"name": "Windows PowerShell",
"commandline": "powershell.exe",
"hidden": false,
"tabTitle": "PowerShell",
"foreground": "#DCDCDC",
"icon": "C:/Users/ChiamZhang/Pictures/Saved Pictures/vz2.png",
"backgroundImage": "C:/Users/ChiamZhang/Pictures/Saved Pictures/back2.jpeg",
"acrylicOpacity": 0.95,
/*亚克力透明效果*/
"backgroundImageOpacity": 0.70,
"backgroundImageStretchMode": "fill",
"colorScheme": "Campbell",
"cursorColor": "#FFFFFF",
"cursorShape": "bar",
"fontFace": "Consoles",
"fontSize": 12,
"historySize": 9001,
"padding": "0, 0, 0, 0",
"snapOnInput": true,
"startingDirectory": "%USERPROFILE%",
"useAcrylic": true
},
{
// Make changes here to the Anaconda Prompt profile 关于anaconda的配置
"guid": "{FCAD2812-51E4-4E55-96AF-2F2B75628FE0}",
"name": "anaconda prompt",
"commandline": "%windir%\\System32\\cmd.exe /K D:\\Users\\KuroNeko\\Anaconda3\\Scripts\\activate.bat",
"hidden": false,
"tabTitle": "Anaconda Prompt", /*名称*/
"foreground": "#DCDCDC", /*字体颜色*/
"icon": "C:/Users/ChiamZhang/Pictures/Saved Pictures/vz2.png", /*ICO图标*/
"backgroundImage": "C:/Users/ChiamZhang/Pictures/Saved Pictures/back2.jpeg", /*终端背景图*/
"acrylicOpacity": 0.75,
"backgroundImageOpacity": 0.1,
"backgroundImageStretchMode": "fill",
"closeOnExit": true,
"colorScheme": "Campbell",
"cursorColor": "#FFFFFF",
"cursorShape": "bar",
"fontFace": "Consolas",
"fontSize": 11,
"historySize": 9001,
"padding": "0, 0, 0, 0",
"snapOnInput": true,
"startingDirectory": "%USERPROFILE%",
"useAcrylic": true
},
{
// Make changes here to the Git Bash profile 关于Git bash的配置
"guid": "{4B25BFD9-4962-49AE-8512-BBD336462BAB}",
"name": "Git Bash",
"commandline": "D:\\Program Files (x86)\\Git\\bin\\bash.exe",
"hidden": false,
"tabTitle": "Git Bash", /*名称*/
"foreground": "#DCDCDC", /*字体颜色*/
"icon": "C:/Users/ChiamZhang/Pictures/Saved Pictures/vz.jpeg", /*ICO图标*/
"backgroundImage": "C:/Users/ChiamZhang/Pictures/Saved Pictures/back.jpg", /*终端背景图*/
"acrylicOpacity": 0.75,
"backgroundImageOpacity": 0.25,
"backgroundImageStretchMode": "fill",
"closeOnExit": true,
"colorScheme": "Campbell",
"cursorColor": "#FFFFFF",
"cursorShape": "bar",
"fontFace": "Consolas",
"fontSize": 11,
"historySize": 9001,
"padding": "0, 0, 0, 0",
"snapOnInput": true,
"startingDirectory": "%USERPROFILE%",
"useAcrylic": true
},
{
"guid": "{b453ae62-4e3d-5e58-b989-0a998ec441b8}",
"hidden": false,
"name": "Azure Cloud Shell",
"source": "Windows.Terminal.Azure"
}
]
},
// Add custom color schemes to this array
"schemes": [],
// Add any keybinding overrides to this array.
// To unbind a default keybinding, set the command to "unbound"
// Add custom color schemes to this array.
// To learn more about color schemes, visit https://aka.ms/terminal-color-schemes
// Add custom actions and keybindings to this array.
// To unbind a key combination from your defaults.json, set the command to "unbound".
// To learn more about actions and keybindings, visit https://aka.ms/terminal-keybindings
"actions": [
// Copy and paste are bound to Ctrl+Shift+C and Ctrl+Shift+V in your defaults.json.
// These two lines additionally bind them to Ctrl+C and Ctrl+V.
// To learn more about selection, visit https://aka.ms/terminal-selection
{
"command": {
"action": "copy",
"singleLine": false
},
"keys": "ctrl+c"
},
{
"command": "paste",
"keys": "ctrl+v"
},
// Press Ctrl+Shift+F to open the search box
{
"command": "find",
"keys": "ctrl+shift+f"
},
// Press Alt+Shift+D to open a new pane.
// - "split": "auto" makes this pane open in the direction that provides the most surface area.
// - "splitMode": "duplicate" makes the new pane use the focused pane's profile.
// To learn more about panes, visit https://aka.ms/terminal-panes
{
"command": {
"action": "splitPane",
"split": "auto",
"splitMode": "duplicate"
},
"keys": "alt+shift+d"
}
]
}
配置启动 Windows Terminal 默认打开的终端,这样打开 Windows Terminal 默认启动的就是 cmd 终端了。
四、更高级的打开方式
通过地址栏启动
在配置文件中添加如下代码,可以在地址栏输入 WT 即可以启动。
通过右键菜单启动
添加右键菜单,在任意路径下右键选择 Windows Terminal 启动
注册表进入如下路径
计算机\HKEY_CLASSES_ROOT\Directory\Background\shell
默认应该会有两个子项,cmd 和 powershell
右击 shell 新增项 Windows Terminal
新增下图所示的四个字符串值及一个 DWORD 值
(默认) 字符串 在此处打开Windows Terminal #这个值是在右键菜单中显示的值
Extended 字符串 #这个值作用是仅支持在按住Shift+右键的时候才显示Windows Terminal选项,删掉则可以不用按住Shift也可以显示Windows Terminal选项
Icon 字符串 C:\Users\xxxx\Pictures\terminal.ico #想要在右键菜单中显示的图标路径,图标需要单独下载
NoWorkingDirectory 字符串
ShowBasedOnVelocityId DWORD 639bc8(十六进制) #在菜单中显示或隐藏Windows Terminal选项
在 Windows Terminal 上右键新建项 command
修改默认值为:
C:\Users\你的用户名\AppData\Local\Microsoft\WindowsApps\wt.exe -d "%V"
配置完成即可在任意文件夹内右键打开 Windows Terminal
更多配置信息参考官方配置文档
『Windows』WindowsTerminal完全配置教程(主题以及启动设置)
https://chiamzhang.github.io/2024/06/29/『Windows』WindowsTerminal完全配置教程(主题以及启动设置)/