pi-win-notify 1.0.9 → 1.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/extensions/host.ps1 +11 -4
- package/package.json +5 -1
package/extensions/host.ps1
CHANGED
|
@@ -157,10 +157,14 @@ function Focus-PiTerminal($hwndNum, $winTitle) {
|
|
|
157
157
|
}
|
|
158
158
|
|
|
159
159
|
$stackFile = "$env:TEMP\pi-notify-stack.txt"
|
|
160
|
+
# 每次宿主启动重置计数器,避免崩溃残留导致窗口位置漂移
|
|
161
|
+
if (Test-Path $stackFile) { Remove-Item $stackFile -Force }
|
|
160
162
|
|
|
161
163
|
function inc-stack {
|
|
162
164
|
$count = 0
|
|
163
165
|
if (Test-Path $stackFile) { try { $count = [int](Get-Content $stackFile -Raw).Trim() } catch {} }
|
|
166
|
+
# 保护:超过 10 层说明 dec-stack 泄露,重置
|
|
167
|
+
if ($count -gt 10) { $count = 0; l '[stack-reset] overflow' }
|
|
164
168
|
$count++
|
|
165
169
|
$count | Out-File -Encoding ascii $stackFile
|
|
166
170
|
return $count
|
|
@@ -241,12 +245,15 @@ function Show-Notify($data) {
|
|
|
241
245
|
$win.FindName('MuteBtn').Add_Click({ $popup.IsOpen = $true })
|
|
242
246
|
|
|
243
247
|
$cursor = [System.Windows.Forms.Cursor]::Position
|
|
244
|
-
$
|
|
245
|
-
$
|
|
248
|
+
$screen = [System.Windows.Forms.Screen]::FromPoint($cursor)
|
|
249
|
+
$waL = $screen.WorkingArea.Left
|
|
250
|
+
$waT = $screen.WorkingArea.Top
|
|
251
|
+
$waW = $screen.WorkingArea.Width
|
|
252
|
+
$waH = $screen.WorkingArea.Height
|
|
246
253
|
$count = inc-stack
|
|
247
254
|
$offset = ($count - 1) * 128
|
|
248
|
-
$win.Left = $waW - $win.Width - 20
|
|
249
|
-
$win.Top = $waH - $win.Height - 10 - $offset
|
|
255
|
+
$win.Left = $waL + $waW - $win.Width - 20
|
|
256
|
+
$win.Top = $waT + $waH - $win.Height - 10 - $offset
|
|
250
257
|
l "[ps-stack] count=$count offset=$offset"
|
|
251
258
|
|
|
252
259
|
$timer = New-Object System.Windows.Threading.DispatcherTimer
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-win-notify",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.11",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A Windows notification tool for pi — fast focus, response preview, elapsed time, mute, multi-language",
|
|
6
6
|
"keywords": [
|
|
@@ -30,5 +30,9 @@
|
|
|
30
30
|
],
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"koffi": "^3.0.2"
|
|
33
|
+
},
|
|
34
|
+
"optionalDependencies": {
|
|
35
|
+
"@koromix/koffi-win32-x64": "3.0.2",
|
|
36
|
+
"@koromix/koffi-win32-ia32": "3.0.2"
|
|
33
37
|
}
|
|
34
38
|
}
|