feat: lock when loading profile + improvements to terminal settings
This commit is contained in:
+36
-34
@@ -15,6 +15,15 @@
|
||||
"command": "paste",
|
||||
"id": "User.paste"
|
||||
},
|
||||
{
|
||||
"command":
|
||||
{
|
||||
"action": "splitPane",
|
||||
"split": "auto",
|
||||
"splitMode": "duplicate"
|
||||
},
|
||||
"id": "User.splitPane.A6751878"
|
||||
},
|
||||
{
|
||||
"command":
|
||||
{
|
||||
@@ -30,11 +39,10 @@
|
||||
{
|
||||
"command":
|
||||
{
|
||||
"action": "splitPane",
|
||||
"split": "auto",
|
||||
"splitMode": "duplicate"
|
||||
"action": "moveFocus",
|
||||
"direction": "left"
|
||||
},
|
||||
"id": "User.splitPane.A6751878"
|
||||
"id": "User.moveFocus.left"
|
||||
},
|
||||
{
|
||||
"command": "toggleFocusMode",
|
||||
@@ -44,17 +52,17 @@
|
||||
"command":
|
||||
{
|
||||
"action": "moveFocus",
|
||||
"direction": "left"
|
||||
"direction": "down"
|
||||
},
|
||||
"id": "User.moveFocus.left"
|
||||
"id": "User.moveFocus.down"
|
||||
},
|
||||
{
|
||||
"command":
|
||||
{
|
||||
"action": "moveFocus",
|
||||
"direction": "down"
|
||||
"action": "resizePane",
|
||||
"direction": "right"
|
||||
},
|
||||
"id": "User.moveFocus.down"
|
||||
"id": "User.resizePane.right"
|
||||
},
|
||||
{
|
||||
"command":
|
||||
@@ -72,14 +80,6 @@
|
||||
},
|
||||
"id": "User.splitPane.right"
|
||||
},
|
||||
{
|
||||
"command":
|
||||
{
|
||||
"action": "resizePane",
|
||||
"direction": "right"
|
||||
},
|
||||
"id": "User.resizePane.right"
|
||||
},
|
||||
{
|
||||
"command":
|
||||
{
|
||||
@@ -88,6 +88,14 @@
|
||||
},
|
||||
"id": "User.moveFocus.right"
|
||||
},
|
||||
{
|
||||
"command":
|
||||
{
|
||||
"action": "resizePane",
|
||||
"direction": "down"
|
||||
},
|
||||
"id": "User.resizePane.down"
|
||||
},
|
||||
{
|
||||
"command":
|
||||
{
|
||||
@@ -100,14 +108,6 @@
|
||||
"command": "closePane",
|
||||
"id": "User.closePane"
|
||||
},
|
||||
{
|
||||
"command":
|
||||
{
|
||||
"action": "resizePane",
|
||||
"direction": "down"
|
||||
},
|
||||
"id": "User.resizePane.down"
|
||||
},
|
||||
{
|
||||
"command":
|
||||
{
|
||||
@@ -126,30 +126,30 @@
|
||||
"defaultProfile": "{574e775e-4f2a-5b96-ac1e-a2962a402336}",
|
||||
"keybindings":
|
||||
[
|
||||
{
|
||||
"id": "User.copy.644BA8F2",
|
||||
"keys": "ctrl+c"
|
||||
},
|
||||
{
|
||||
"id": "Terminal.ToggleFocusMode",
|
||||
"keys": "alt+z"
|
||||
},
|
||||
{
|
||||
"id": "User.paste",
|
||||
"keys": "ctrl+v"
|
||||
"id": "User.copy.644BA8F2",
|
||||
"keys": "ctrl+c"
|
||||
},
|
||||
{
|
||||
"id": "User.find",
|
||||
"keys": "ctrl+shift+f"
|
||||
},
|
||||
{
|
||||
"id": "User.splitPane.A6751878",
|
||||
"keys": "alt+shift+d"
|
||||
"id": "User.paste",
|
||||
"keys": "ctrl+v"
|
||||
},
|
||||
{
|
||||
"id": "User.moveFocus.up",
|
||||
"keys": "alt+k"
|
||||
},
|
||||
{
|
||||
"id": "User.splitPane.A6751878",
|
||||
"keys": "alt+shift+d"
|
||||
},
|
||||
{
|
||||
"id": "User.moveFocus.left",
|
||||
"keys": "alt+h"
|
||||
@@ -231,7 +231,8 @@
|
||||
"name": "PowerShell",
|
||||
"opacity": 100,
|
||||
"padding": "7",
|
||||
"source": "Windows.Terminal.PowershellCore"
|
||||
"source": "Windows.Terminal.PowershellCore",
|
||||
"tabTitle": "terminal"
|
||||
},
|
||||
{
|
||||
"colorScheme": "One Half Dark",
|
||||
@@ -271,6 +272,7 @@
|
||||
]
|
||||
},
|
||||
"schemes": [],
|
||||
"searchWebDefaultQueryUrl": "https://www.google.com/search?q=%22%s%22",
|
||||
"themes": [],
|
||||
"useAcrylicInTabRow": true
|
||||
}
|
||||
@@ -2,8 +2,14 @@ $CurrentDir = if ($PSScriptRoot) { $PSScriptRoot } else { Split-Path -Parent $PR
|
||||
$ProfileDir = Join-Path -Path $CurrentDir -ChildPath "Profile"
|
||||
|
||||
if (Test-Path -Path $ProfileDir) {
|
||||
$ProfileScripts = Get-ChildItem -Path $ProfileDir -Filter "*.ps1" | Sort-Object Name
|
||||
$mutexName = "Global\PowerShellProfileInit"
|
||||
$mutex = [System.Threading.Mutex]::new($false, $mutexName)
|
||||
$acquired = $false
|
||||
|
||||
try {
|
||||
$acquired = $mutex.WaitOne(10000)
|
||||
if ($acquired) {
|
||||
$ProfileScripts = Get-ChildItem -Path $ProfileDir -Filter "*.ps1" | Sort-Object Name
|
||||
foreach ($Script in $ProfileScripts) {
|
||||
try {
|
||||
. $Script.FullName
|
||||
@@ -12,6 +18,16 @@ if (Test-Path -Path $ProfileDir) {
|
||||
Write-Warning "Failed to load profile module: $($Script.Name). Error: $($_.Exception.Message)"
|
||||
}
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
Write-Warning "Profile initialization lock timed out — another terminal may be loading."
|
||||
}
|
||||
}
|
||||
finally {
|
||||
if ($acquired) { $mutex.ReleaseMutex() }
|
||||
$mutex.Dispose()
|
||||
}
|
||||
}
|
||||
else {
|
||||
Write-Warning "Profile directory not found at: $ProfileDir"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user