9remote 2.0.31 → 2.0.57
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/dist/assets/tray.ps1 +129 -0
- package/dist/cli.cjs +154 -60
- package/dist/install.cjs +1 -1
- package/dist/ptyDaemon.cjs +5 -5
- package/dist/server.cjs +64 -62
- package/dist/ui/agents/claude.svg +1 -0
- package/dist/ui/agents/codex.svg +1 -0
- package/dist/ui/agents/gemini.svg +1 -0
- package/dist/ui/agents/opencode.svg +1 -0
- package/dist/ui/assets/{index-CzK2QQU8.js → index-Ct-F6Gco.js} +3442 -2417
- package/dist/ui/assets/{index-Casn8c07.css → index-DbeWsL_A.css} +50 -0
- package/dist/ui/index.html +2 -2
- package/package.json +1 -1
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
# 9Remote tray icon for Windows using NotifyIcon
|
|
2
|
+
# IPC: stdin JSON commands, stdout JSON events
|
|
3
|
+
param([string]$IconPath, [string]$Tooltip)
|
|
4
|
+
|
|
5
|
+
$ErrorActionPreference = "Stop"
|
|
6
|
+
|
|
7
|
+
Add-Type @"
|
|
8
|
+
using System;
|
|
9
|
+
using System.Runtime.InteropServices;
|
|
10
|
+
|
|
11
|
+
public static class WinDpiAwareness {
|
|
12
|
+
public static IntPtr PerMonitorAwareV2 { get { return new IntPtr(-4); } }
|
|
13
|
+
public static IntPtr PerMonitorAware { get { return new IntPtr(-3); } }
|
|
14
|
+
|
|
15
|
+
[DllImport("user32.dll")]
|
|
16
|
+
public static extern bool SetProcessDpiAwarenessContext(IntPtr value);
|
|
17
|
+
|
|
18
|
+
[DllImport("user32.dll")]
|
|
19
|
+
public static extern IntPtr SetThreadDpiAwarenessContext(IntPtr value);
|
|
20
|
+
|
|
21
|
+
[DllImport("shcore.dll")]
|
|
22
|
+
public static extern int SetProcessDpiAwareness(int value);
|
|
23
|
+
|
|
24
|
+
[DllImport("user32.dll")]
|
|
25
|
+
public static extern bool SetProcessDPIAware();
|
|
26
|
+
}
|
|
27
|
+
"@
|
|
28
|
+
|
|
29
|
+
function Enable-HighDpiAwareness {
|
|
30
|
+
$contexts = @(
|
|
31
|
+
[WinDpiAwareness]::PerMonitorAwareV2,
|
|
32
|
+
[WinDpiAwareness]::PerMonitorAware
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
foreach ($context in $contexts) {
|
|
36
|
+
try {
|
|
37
|
+
if ([WinDpiAwareness]::SetProcessDpiAwarenessContext($context)) { break }
|
|
38
|
+
} catch {}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
try { [WinDpiAwareness]::SetProcessDpiAwareness(2) | Out-Null } catch {}
|
|
42
|
+
try { [WinDpiAwareness]::SetProcessDPIAware() | Out-Null } catch {}
|
|
43
|
+
|
|
44
|
+
foreach ($context in $contexts) {
|
|
45
|
+
try {
|
|
46
|
+
$previous = [WinDpiAwareness]::SetThreadDpiAwarenessContext($context)
|
|
47
|
+
if ($previous -ne [IntPtr]::Zero) { break }
|
|
48
|
+
} catch {}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
Enable-HighDpiAwareness
|
|
53
|
+
|
|
54
|
+
Add-Type -AssemblyName System.Windows.Forms
|
|
55
|
+
Add-Type -AssemblyName System.Drawing
|
|
56
|
+
|
|
57
|
+
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
|
|
58
|
+
[Console]::InputEncoding = [System.Text.Encoding]::UTF8
|
|
59
|
+
$OutputEncoding = [System.Text.Encoding]::UTF8
|
|
60
|
+
|
|
61
|
+
[System.Windows.Forms.Application]::EnableVisualStyles()
|
|
62
|
+
[System.Windows.Forms.Application]::SetCompatibleTextRenderingDefault($false)
|
|
63
|
+
|
|
64
|
+
$script:notifyIcon = New-Object System.Windows.Forms.NotifyIcon
|
|
65
|
+
$script:notifyIcon.Icon = New-Object System.Drawing.Icon($IconPath)
|
|
66
|
+
$script:notifyIcon.Text = $Tooltip
|
|
67
|
+
$script:notifyIcon.Visible = $true
|
|
68
|
+
|
|
69
|
+
$script:menu = New-Object System.Windows.Forms.ContextMenuStrip
|
|
70
|
+
$script:notifyIcon.ContextMenuStrip = $script:menu
|
|
71
|
+
$script:items = @()
|
|
72
|
+
|
|
73
|
+
function Write-Event($obj) {
|
|
74
|
+
$json = $obj | ConvertTo-Json -Compress
|
|
75
|
+
[Console]::Out.WriteLine($json)
|
|
76
|
+
[Console]::Out.Flush()
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function Add-MenuItem($index, $title, $enabled) {
|
|
80
|
+
$item = New-Object System.Windows.Forms.ToolStripMenuItem
|
|
81
|
+
$item.Text = $title
|
|
82
|
+
$item.Enabled = $enabled
|
|
83
|
+
$idx = $index
|
|
84
|
+
$item.Add_Click({ Write-Event @{ type = "click"; index = $idx } }.GetNewClosure())
|
|
85
|
+
$script:menu.Items.Add($item) | Out-Null
|
|
86
|
+
$script:items += $item
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function Update-MenuItem($index, $title, $enabled) {
|
|
90
|
+
if ($index -lt $script:items.Count) {
|
|
91
|
+
$script:items[$index].Text = $title
|
|
92
|
+
$script:items[$index].Enabled = $enabled
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function Set-Tooltip($text) {
|
|
97
|
+
# NotifyIcon.Text max 63 chars
|
|
98
|
+
if ($text.Length -gt 63) { $text = $text.Substring(0, 63) }
|
|
99
|
+
$script:notifyIcon.Text = $text
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
# Poll stdin via UI-thread timer so menu clicks and IPC share one thread
|
|
103
|
+
$script:timer = New-Object System.Windows.Forms.Timer
|
|
104
|
+
$script:timer.Interval = 100
|
|
105
|
+
$script:timer.Add_Tick({
|
|
106
|
+
try {
|
|
107
|
+
while ([Console]::In.Peek() -ne -1) {
|
|
108
|
+
$line = [Console]::In.ReadLine()
|
|
109
|
+
if ([string]::IsNullOrWhiteSpace($line)) { continue }
|
|
110
|
+
$cmd = $line | ConvertFrom-Json
|
|
111
|
+
switch ($cmd.action) {
|
|
112
|
+
"add-item" { Add-MenuItem $cmd.index $cmd.title $cmd.enabled }
|
|
113
|
+
"update-item" { Update-MenuItem $cmd.index $cmd.title $cmd.enabled }
|
|
114
|
+
"set-tooltip" { Set-Tooltip $cmd.text }
|
|
115
|
+
"kill" {
|
|
116
|
+
$script:notifyIcon.Visible = $false
|
|
117
|
+
$script:notifyIcon.Dispose()
|
|
118
|
+
[System.Windows.Forms.Application]::Exit()
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
} catch {
|
|
123
|
+
Write-Event @{ type = "error"; message = $_.Exception.Message }
|
|
124
|
+
}
|
|
125
|
+
})
|
|
126
|
+
$script:timer.Start()
|
|
127
|
+
|
|
128
|
+
Write-Event @{ type = "started" }
|
|
129
|
+
[System.Windows.Forms.Application]::Run()
|