microsoft / terminal

The new Windows Terminal and the original Windows console host, all in the same place!
MIT License
94.36k stars 8.17k forks source link

`settings.json` gets regenerated after it is deleted while Windows Terminal is running #17455

Open soredake opened 3 weeks ago

soredake commented 3 weeks ago

Description of the new feature/enhancement

I store most of my configs in git, I link them with dploy tool, but, there is a problem with Windows Terminal behavior, on windows 11 windows terminal is set as default terminal application, this means all powershell script that I will run from explorer context menu will spawn windows terminal, the problem with windows terminal started is that to link my settings.json config file (for windows terminal) I need to first delete it from $HOME\AppData\Local\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState folder, but, when windows terminal is running it will almost immediately will write settings.json to disk even thought you are not changing any settings at this moment, this breaks dploy linking as settings.json file is present.

As a workaround l link this config with New-Item -ItemType SymbolicLink as it's fast enough to create link before this config is written to disk:

Remove-Item -Path $env:LOCALAPPDATA\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\settings.json
New-Item -ItemType SymbolicLink -Path $env:LOCALAPPDATA\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\settings.json -Target $HOME\git\dotfiles_windows\dotfiles\AppData\Local\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\settings.json

Proposed technical implementation details (optional)

PankajBhojwani commented 2 weeks ago

Thank you for this! Yep we see how that can be annoying