triflux 4.1.0 → 4.1.1
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/hub/tray.mjs +24 -7
- package/package.json +1 -1
package/hub/tray.mjs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import _SysTrayModule from "systray2";
|
|
4
4
|
const SysTray = _SysTrayModule.default || _SysTrayModule;
|
|
5
5
|
import { exec } from "node:child_process";
|
|
6
|
-
import { readFileSync } from "node:fs";
|
|
6
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
7
7
|
import { homedir } from "node:os";
|
|
8
8
|
import { join, resolve } from "node:path";
|
|
9
9
|
import { fileURLToPath } from "node:url";
|
|
@@ -164,15 +164,32 @@ function buildUsageTitle(snapshot) {
|
|
|
164
164
|
return `C: ${formatMenuPercent(snapshot.claude)} | X: ${formatMenuPercent(snapshot.codex)} | G: ${formatMenuPercent(snapshot.gemini)}`;
|
|
165
165
|
}
|
|
166
166
|
|
|
167
|
+
function findChromePath() {
|
|
168
|
+
const candidates = [
|
|
169
|
+
join(process.env.ProgramFiles || "", "Google", "Chrome", "Application", "chrome.exe"),
|
|
170
|
+
join(process.env["ProgramFiles(x86)"] || "", "Google", "Chrome", "Application", "chrome.exe"),
|
|
171
|
+
join(process.env.LOCALAPPDATA || "", "Google", "Chrome", "Application", "chrome.exe"),
|
|
172
|
+
];
|
|
173
|
+
for (const p of candidates) {
|
|
174
|
+
try { if (existsSync(p)) return p; } catch {}
|
|
175
|
+
}
|
|
176
|
+
return null;
|
|
177
|
+
}
|
|
178
|
+
|
|
167
179
|
function openDashboard() {
|
|
168
180
|
const url = getDashboardUrl();
|
|
169
181
|
const shell = process.env.ComSpec || "cmd.exe";
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
182
|
+
const chrome = findChromePath();
|
|
183
|
+
if (chrome) {
|
|
184
|
+
// Chrome --app: 주소바/탭 없는 앱 윈도우로 열기
|
|
185
|
+
exec(`start "" "${chrome}" "--app=${url}"`, { shell, windowsHide: true }, (err) => {
|
|
186
|
+
if (err) {
|
|
187
|
+
exec(`start "" "${url}"`, { shell, windowsHide: true }, () => {});
|
|
188
|
+
}
|
|
189
|
+
});
|
|
190
|
+
} else {
|
|
191
|
+
exec(`start "" "${url}"`, { shell, windowsHide: true }, () => {});
|
|
192
|
+
}
|
|
176
193
|
}
|
|
177
194
|
|
|
178
195
|
const openDashboardItem = {
|