terminal icon indicating copy to clipboard operation
terminal copied to clipboard

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

Open soredake opened this issue 2 weeks ago • 1 comments

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)

soredake avatar Jun 20 '24 19:06 soredake