@vincentbanana/banana-gui 0.4.3 → 0.4.4

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.
@@ -32,11 +32,11 @@ if (!binary) {
32
32
  }
33
33
 
34
34
  const main = join(here, '..', 'desktop', 'main.cjs');
35
- // 独立窗口模式:把 electron 放出去,命令行立刻返回,不留黑终端窗口
35
+ // 独立窗口模式:把 electron 放出去,命令行立刻返回,不留黑终端窗口。
36
+ // 不能用 windowsHide:实测那会让 Electron 的窗口创建不出来(只有终端、没有窗口)。
36
37
  const child = spawn(binary, [main, ...args], {
37
38
  detached: true,
38
39
  stdio: 'ignore',
39
- windowsHide: true,
40
40
  env: { ...process.env, BANANA_UI_DIR: join(here, '..', 'ui') },
41
41
  });
42
42
  child.unref();
@@ -158,11 +158,11 @@ if (args.includes('--desktop')) {
158
158
  process.exit(1);
159
159
  }
160
160
  // 独立窗口模式:把 electron 放出去,命令行立刻返回,
161
- // 不留一个黑终端窗口挡着(关掉 Banana 窗口即退出,里面的服务会一起收掉)
161
+ // 不留一个黑终端窗口挡着(关掉 Banana 窗口即退出,里面的服务会一起收掉)。
162
+ // 注意:不能用 windowsHide,实测那会让 Electron 的窗口创建不出来(只有终端、没有窗口)。
162
163
  const child = spawn(binary, [join(here, '..', 'desktop', 'main.cjs'), ...kernelArgs()], {
163
164
  detached: true,
164
165
  stdio: 'ignore',
165
- windowsHide: true,
166
166
  });
167
167
  child.unref();
168
168
  console.log('Banana 桌面版已启动,关闭窗口即退出。');
package/desktop/main.cjs CHANGED
@@ -75,9 +75,14 @@ async function createWindow() {
75
75
  backgroundColor: '#ffffff',
76
76
  title: 'Banana',
77
77
  autoHideMenuBar: true,
78
+ // 先不显示,等页面就绪再 show():启动器用了 windowsHide,
79
+ // 那种情况下 Electron 会把首个窗口以隐藏状态创建,不显式 show 就看不到
80
+ show: false,
78
81
  webPreferences: { contextIsolation: true, nodeIntegration: false, sandbox: true },
79
82
  });
80
83
  await win.loadURL(url);
84
+ win.show();
85
+ win.focus();
81
86
  win.on('closed', () => {
82
87
  win = null;
83
88
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vincentbanana/banana-gui",
3
- "version": "0.4.3",
3
+ "version": "0.4.4",
4
4
  "description": "Banana 的图形界面:本地服务 + 浏览器。黑白主题,自绘图标,无第三方 UI 依赖",
5
5
  "type": "module",
6
6
  "engines": {