- General profile settings in Windows Terminal
- Command line
- Starting directory
- Tab title
- Hide profile from dropdown
- Troubleshooting in Windows Terminal
- Opening the settings does nothing (or opens an unexpected application)
- Set your WSL distribution to start in the home
- Setting the tab title
- Command line arguments in PowerShell
- Command line arguments in WSL
- Problem setting startingDirectory
- Deleting a profile
- Ctrl+= does not increase the font size
- The text is blurry
- My colors look strange! There are black bars on my screen!
- Black lines in PowerShell (5.1, 6.x, 7.0)
- Why are my emojis not appearing as icons in the jumplist?
- Technical Notes
- Keyboard service warning
- Начало работы с Windows Terminal
- Установка
- Требования
- Windows Terminal Preview
- Windows Terminal
- Первый запуск
- Профили
- Дефолтный профиль
- Добавление нового профиля
- Структура Settings.json
- Базовая кастомизация
- Цветовая схема
- Начертание шрифта
General profile settings in Windows Terminal
The settings listed below are specific to each unique profile. If you’d like a setting to apply to all of your profiles, you can add it to the defaults section above the list of profiles in your settings.json file.
This is the name of the profile that will be displayed in the dropdown menu. This value is also used as the «title» to pass to the shell on startup. Some shells (like bash ) may choose to ignore this initial value, while others ( Command Prompt , PowerShell ) may use this value over the lifetime of the application. This «title» behavior can be overridden by using tabTitle .
Property name: name
Necessity: Required
Accepts: String
Command line
This is the executable used in the profile.
Property name: commandline
Necessity: Optional
Accepts: Executable file name as a string
Default value: «cmd.exe»
Starting directory
This is the directory the shell starts in when it is loaded.
Property name: startingDirectory
Necessity: Optional
Accepts: Folder location as a string
Default value: «%USERPROFILE%»
Example: Start the PowerShell profile in the GitHubRepos folder of your Documents directory by finding the powershell.exe profile and adding «startingDirectory»: «%USERPROFILE%/Documents/GitHubRepos»,
Example with WSL: When setting the starting directory for a Linux distribution installed via WSL, use the format: «startingDirectory»: «\\\\wsl$\\DISTRO NAME\\home\\USERNAME» , replacing with the placeholders with the proper names of your distribution. For example, «startingDirectory»: «\\\\wsl$\\Ubuntu-20.04\\home\\user1» .
Default behavior: When the startingDirectory value is not specified, you will get different results depending on where you launch Terminal:
- If you run Windows Terminal from the Start menu: C:\windows\system32
- If you run wt.exe from the Start menu: C:\windows\system32
- If you run wt.exe from Win+R: %USERPROFILE%
- If you run wt.exe from the explorer address bar: whatever folder you were looking at.
Backslashes need to be escaped. For example, C:\Users\USERNAME\Documents should be entered as C:\\Users\\USERNAME\\Documents .
This sets the icon that displays within the tab, dropdown menu, jumplist, and tab switcher.
Property name: icon
Necessity: Optional
Accepts: File location as a string, or an emoji
Example: By placing the icon image ubuntu.ico in the folder located at %LOCALAPPDATA%\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\RoamingState , you can display the icon by adding this line to the profile in your settings.json: «icon»: «ms-appdata:///roaming/ubuntu.ico» .
Tab title
If set, this will replace the name as the title to pass to the shell on startup. Some shells (like bash ) may choose to ignore this initial value, while others ( Command Prompt , PowerShell ) may use this value over the lifetime of the application. If you’d like to learn how to have the shell set your title, visit the tab title tutorial.
Property name: tabTitle
Necessity: Optional
Accepts: String
Hide profile from dropdown
If hidden is set to true , the profile will not appear in the list of profiles. This can be used to hide default profiles and dynamically generated profiles, while leaving them in your settings file. To learn more about dynamic profiles, visit the Dynamic profiles page.
Troubleshooting in Windows Terminal
This guide addresses some of the common errors and obstacles you may encounter when using Windows Terminal.
Opening the settings does nothing (or opens an unexpected application)
If you click on the «settings» button in the dropdown, the Terminal will attempt to open the settings file, settings.json . This will cause the OS to try and launch your configured .json file editor. This might be Visual Studio, or Notepad, or some other completely unexpected application. If there isn’t a configured .json editor on your machine, then the OS will eventually show you the «How do you want to open this file» dialog.
You can also use the settings UI to configure your settings if you are using Windows Terminal Preview. You can learn how to open the settings UI on the Actions page.
Set your WSL distribution to start in the home
directory when launched
By default, the startingDirectory of a profile is %USERPROFILE% ( C:\Users\ ). This is a Windows path. For WSL, however, you may want to use the WSL home path instead. startingDirectory only accepts a Windows-style path, so setting it to start within a WSL distribution requires a prefix.
Beginning in Windows 10 version 1903, the file systems of WSL distributions can be addressed using the \\wsl$\ prefix. For any WSL distribution with the name DistroName , use \\wsl$\DistroName as a Windows path that points to the root of that distribution’s file system.
For example, the following setting will launch the «Ubuntu-18.04» distribution in its home file path:
Setting the tab title
To have the shell automatically set your tab title, visit the set the tab title tutorial. If you want to set your own tab title, open the settings.json file and follow these steps:
In the profile for the command line of your choice, add «suppressApplicationTitle»: true to suppress any title change events that get sent from the shell. Adding only this setting to your profile will set the tab title to the name of your profile.
If you want a custom tab title that is not the name of your profile, add «tabTitle»: «TITLE» . Replacing «TITLE» with your preferred tab title.
Command line arguments in PowerShell
Visit the Command line arguments page to learn how command-line arguments operate in PowerShell.
Command line arguments in WSL
Visit the Command line arguments page to learn how command-line arguments operate in WSL.
Problem setting startingDirectory
If the startingDirectory is being ignored in your profile, first check to make sure your settings.json’s syntax is correct. To help you check this syntax, «$schema»: «https://aka.ms/terminal-profiles-schema» is automatically injected. Some applications, like Visual Studio Code, can use that injected schema to validate your json file as you make edits.
If your settings are correct, you may be running a startup script that sets the starting directory of your terminal separately. For example, PowerShell has its own separate concept of profiles. If you are changing your starting directory there, it will take precedence over the setting defined in Windows Terminal.
Alternatively, if you are running a script using the commandline profile setting, it may be that you are setting the location there. Similar to PowerShell profiles, your commands there take precedence over the startingDirectory profile setting.
The purpose of startingDirectory is to launch a new Windows Terminal instance in the given directory. If the terminal runs any code that changes its directory, that may be a good place to take a look.
Deleting a profile
By default, Windows Terminal ships with a built-in PowerShell and a Command Prompt profile. The terminal will also autodetect if other command line applications are installed, such as PowerShell Core, WSL distributions (Ubuntu, Debian, etc), and Azure Cloud Shell. We call these types of automatically generated profiles «Dynamic profiles».
For both built-in and dynamic profiles, deleting the profile from your settings.json file will not remove it from your profiles. Built-in profiles are defined in defaults.json , so they’re always available. Dynamic profiles will attempt to create a JSON stub for their profile in your settings.json file whenever a profile is not already present in the file.
The only way to truly remove these profiles from the list is by «hiding» them. To hide a profile, add the property «hidden»: true to the profile.
Ctrl+= does not increase the font size
If you are using a German keyboard layout, you may run into this problem. ctrl+= gets deserialized as ctrl+shift+0 if your main keyboard layout is set to German. This is the correct mapping for German keyboards.
More importantly, the app never receives the ctrl+shift+0 keystroke. This is because ctrl+shift+0 is reserved by Windows if you have multiple keyboard layouts active.
If you would like to disable this feature in order for Ctrl+= to work properly, follow the instructions for «Change Hotkeys to Switch Keyboard Layout in Windows 10» in this blog post.
Change the ‘Switch Keyboard Layout’ option to ‘Not Assigned’ (or off of ctrl+shift ), then select OK and then Apply. ctrl+shift+0 should now work as a key binding and is passed through to the terminal.
On the other hand, if you do use this hotkey feature for multiple input languages, you can configure your own custom key binding in your settings.json file.
The text is blurry
Some display drivers and hardware combinations do not handle scroll and/or dirty regions without blurring the data from the previous frame. To mitigate this problem, you can add a combination of these global rendering settings to reduce the strain placed on your hardware caused by the terminal text renderer.
My colors look strange! There are black bars on my screen!
This applies only to version 1.2+ of Windows Terminal. If you are seeing color issues in Windows Terminal 1.0 or 1.1, or issues that are not captured here, please file a bug.
Windows Terminal 1.2 and beyond has an improved understanding of certain application color settings. Because of this improved understanding, we have been able to remove a number of compatibility blocks that resulted in a poor user experience. Unfortunately, there is a small number of applications that may experience issues.
We will keep this troubleshooting item up-to-date with the list of known issues and their workarounds.
Black lines in PowerShell (5.1, 6.x, 7.0)
Terminal, when coupled with PowerShell’s line editing library PSReadline, may draw black lines across the screen. These miscolored regions will extend across the screen beyond your prompt wherever there are command parameters, strings or operators.
PSReadline version 2.0.3 has been released and contains a fix for this issue. If you are using the prerelease version of PSReadline, note that a fix is not yet available.
To update to the newest version of PSReadline, please run the following command:
Why are my emojis not appearing as icons in the jumplist?
Only images linked from a file location can be rendered as profile icons in the jumplist. Emojis are not supported for jumplist icons.
Technical Notes
Applications that use the GetConsoleScreenBufferInfo family of APIs to retrieve the active console colors in Win32 format and then attempt to transform them into cross-platform VT sequences (for example, by transforming BACKGROUND_RED to \x1b[41m ) may interfere with Terminal’s ability to detect what background color the application is attempting to use.
Application developers are encouraged to choose either Windows API functions or VT sequences for adjusting colors and not attempt to mix them.
Keyboard service warning
Starting in Windows Terminal 1.5, the Terminal will display a warning if the «Touch Keyboard and Handwriting Panel Service» is disabled. This service is needed by the operating system to properly route input events to the Terminal application (as well as many other applications on Windows). If you see this warning, you can follow these steps to re-enable the service:
- In the run dialog, run services.msc
- Find the «Touch Keyboard and Handwriting Panel Service»
- Open the «Properties» for this service
- Change the «startup type» to «Automatic»
- Hit «Ok», and restart the PC.
After restarting the machine, the service should auto-start, and the dialog should no longer appear.
Начало работы с Windows Terminal
Привет, Хабр! Сегодня делимся гайдом по началу работы с Windows Terminal. Да, поскольку он о начале работы с инструментом, в основном в материале описываются какие-то базовые моменты. Но я думаю, что и профессионалы смогут подчерпнуть для себя что-то полезное, как минимум из списка полезных ссылок в конце статьи. Заглядывайте под кат!
Установка
Windows Terminal доступен в двух разных сборках: Windows Terminal и Windows Terminal Preview. Обе сборки доступны для загрузки в Microsoft Store и на странице выпусков GitHub.
Требования
Для запуска любой сборки Windows Terminal на вашем компьютере должна быть установлена Windows 10 1903 или более поздняя версия.
Windows Terminal Preview
Windows Terminal
Терминал Windows — это основная сборка продукта. Функции, которые поступают в Windows Terminal Preview, появляются в Windows Terminal через месяц эксплуатации. Это позволяет проводить обширное тестирование ошибок и стабилизацию новых функций. Эта сборка предназначена для тех, кто хочет получить функции после того, как они были изучены и протестированы сообществом Preview.
Первый запуск
После установки терминала вы можете запустить приложение и сразу приступить к работе с командной строкой. По умолчанию терминал включает профили Windows PowerShell, Command Prompt и Azure Cloud Shell в раскрывающемся списке. Если на вашем компьютере установлены дистрибутивы Подсистемы Windows для Linux (WSL), они также должны динамически заполняться как профили при первом запуске терминала.
Профили
Профили действуют как различные среды командной строки, которые вы можете настраивать внутри терминала. По умолчанию в каждом профиле используется отдельный исполняемый файл командной строки, однако вы можете создать столько профилей, сколько захотите, используя один и тот же исполняемый файл. Каждый профиль может иметь свои собственные настройки, которые помогут вам различать их и добавить в каждый свой собственный стиль.
Дефолтный профиль
При первом запуске Windows Terminal в качестве профиля по умолчанию устанавливается Windows PowerShell. Профиль по умолчанию — это профиль, который всегда открывается при запуске терминала, и это профиль, который открывается при нажатии кнопки новой вкладки. Вы можете изменить профиль по умолчанию, установив «defaultProfile» на имя вашего предпочтительного профиля в файле settings.json.
Добавление нового профиля
Новые профили можно добавлять динамически с помощью терминала или вручную. Терминал Windows автоматически создаст профили для распределений PowerShell и WSL. Эти профили будут иметь свойство «source», которое сообщает терминалу, где он может найти соответствующий исполняемый файл.
Если вы хотите создать новый профиль вручную, вам просто нужно сгенерировать новый «guid», указать «name» и предоставить исполняемый файл для свойства «commandline».
Примечание. Вы не сможете скопировать свойство «source» из динамически созданного профиля. Терминал просто проигнорирует этот профиль. Вам нужно будет заменить «source» на «commandline» и предоставить исполняемый файл, чтобы дублировать динамически созданный профиль.
Структура Settings.json
В Терминал Windows включены два файла настроек. Один из них — defaults.json, который можно открыть, удерживая клавишу Alt и нажав кнопку «Настройки» в раскрывающемся списке. Это неизменяемый файл, который включает в себя все настройки по умолчанию, которые поставляются с терминалом. Второй файл — settings.json, в котором вы можете применить все свои пользовательские настройки. Доступ к нему можно получить, нажав кнопку «Настройки» в раскрывающемся меню.
Файл settings.json разделен на четыре основных раздела. Первый — это объект глобальных настроек, который находится в верхней части файла JSON внутри первого <. Примененные здесь настройки повлияют на все приложение.
Следующим основным разделом файла является объект «profiles». Объект «profiles» разделен на два раздела: «defaults» и «list». Вы можете применить настройки профиля к объекту «defaults», и они будут применяться ко всем профилям в вашем «list». «list» содержит каждый объект профиля, который представляет профили, описанные выше, и это элементы, которые появляются в раскрывающемся меню вашего терминала. Настройки, примененные к отдельным профилям в «списке», имеют приоритет над настройками, примененными в разделе «defaults».
Далее в файле расположен массив «schemes». Здесь можно разместить собственные цветовые схемы. Отличный инструмент, который поможет вам создать свои собственные цветовые схемы, — это terminal.sexy.
Наконец, в нижней части файла находится массив «actions». Перечисленные здесь объекты добавляют действия в ваш терминал, которые можно вызывать с клавиатуры и/или находить внутри палитры команд.
Базовая кастомизация
Вот несколько основных настроек, которые помогут вам начать настройку вашего терминала.
Одна из самых популярных настроек — настраиваемое фоновое изображение. Это настройка профиля, поэтому ее можно либо поместить внутри объекта «defaults» внутри объекта «profiles», чтобы применить ко всем профилям, либо внутри определенного объекта профиля.
Параметр «backgroundImage» принимает расположение файла изображения, которое вы хотите использовать в качестве фона вашего профиля. Допустимые типы файлов: .jpg, .png, .bmp, .tiff, .ico и .gif.
Цветовая схема
Список доступных цветовых схем можно найти на нашем сайте документации. Цветовые схемы применяются на уровне профиля, поэтому вы можете поместить настройку внутри «значений по умолчанию» или в конкретный объект профиля.
Этот параметр принимает название цветовой схемы. Вы также можете создать свою собственную цветовую схему и поместить ее в список «schemes», а затем установить в настройках профиля имя этой новой схемы, чтобы применить ее.
Начертание шрифта
По умолчанию Windows Terminal использует Cascadia Mono в качестве шрифта. Начертание шрифта — это настройка уровня профиля. Вы можете изменить шрифт, установив «fontFace» на имя шрифта, который вы хотите использовать.
Совет: Терминал Windows также поставляется с начертанием шрифта Cascadia Code, который включает программные лигатуры (см. Gif ниже). Если вы используете Powerline, Cascadia Code также поставляется в PL-версии, которую можно загрузить с GitHub.