@kitkat-vn/kitcode 0.2.0-staging.6 → 0.2.0-staging.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kitkat-vn/kitcode",
3
- "version": "0.2.0-staging.6",
3
+ "version": "0.2.0-staging.7",
4
4
  "description": "Local aggregate activity server for KitCode.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -37,5 +37,5 @@
37
37
  "optionalDependencies": {
38
38
  "electron": "^43.0.0"
39
39
  },
40
- "gitHead": "db529cdd770406de653f0ab1a448c868cc0af68a"
40
+ "gitHead": "91818f8efdd897617e47dc344e5fe65fc596cbf0"
41
41
  }
@@ -0,0 +1,29 @@
1
+ import path from 'node:path';
2
+ import {fileURLToPath} from 'node:url';
3
+
4
+ // The name and icon of KitCode's Electron windows, Welcome and the Mini (the operator, 2026-10-03): "KitCode Companion",
5
+ // and the web dashboard's favicon, rendered as a 512 × 512 PNG, which Electron reads where it cannot read an SVG.
6
+ //
7
+ // What it changes: the app's name for Electron (menus, notifications), the Dock's icon on macOS while a window is open,
8
+ // and each window's icon on Windows and Linux. What it cannot: the Dock's label on macOS, which is the running bundle's
9
+ // name, Electron's own, until KitCode ships an app bundle of its own.
10
+ export const APP_NAME = 'KitCode Companion';
11
+ export const ICON_PATH = path.join(path.dirname(fileURLToPath(import.meta.url)), 'assets', 'kitcode-icon.png');
12
+
13
+ // Called before the app is ready: the name. Never throws: a window opens without it.
14
+ export function nameApp(app) {
15
+ try {
16
+ app.setName(APP_NAME);
17
+ } catch {
18
+ // The name is cosmetic.
19
+ }
20
+ }
21
+
22
+ // Called once the app is ready: the Dock's icon on macOS. Never throws.
23
+ export function showAppIcon(app) {
24
+ try {
25
+ app.dock?.setIcon(ICON_PATH);
26
+ } catch {
27
+ // The icon is cosmetic.
28
+ }
29
+ }
Binary file
@@ -1,4 +1,5 @@
1
1
  import {app, BrowserWindow, ipcMain, nativeTheme, screen, shell} from 'electron';
2
+ import {ICON_PATH, nameApp, showAppIcon} from './app-identity.mjs';
2
3
  import path from 'node:path';
3
4
  import {fileURLToPath} from 'node:url';
4
5
  import {reachableAddress} from './api-access.mjs';
@@ -39,6 +40,7 @@ async function trackerReady() {
39
40
  function createMiniWindow(url) {
40
41
  const position = miniPosition();
41
42
  miniWindow = new BrowserWindow({
43
+ icon: ICON_PATH,
42
44
  width: miniWidth, height: miniHeight,
43
45
  minWidth: miniWidth, minHeight: miniHeight, maxWidth: miniWidth, maxHeight: miniHeight,
44
46
  x: position.x, y: position.y, frame: false, transparent: true, hasShadow: false,
@@ -58,7 +60,10 @@ function createMiniWindow(url) {
58
60
  miniWindow.loadURL(url);
59
61
  }
60
62
 
63
+ nameApp(app);
64
+
61
65
  app.whenReady().then(async () => {
66
+ showAppIcon(app);
62
67
  nativeTheme.themeSource = 'dark';
63
68
  const connected = await trackerReady();
64
69
  const miniUrl = connected
@@ -11,7 +11,7 @@ ${fontFaces(['vt323', 'fira-code'])}
11
11
  *{box-sizing:border-box;margin:0;padding:0}
12
12
  html,body{position:relative;width:100%;height:100%;margin:0;overflow:hidden;background:transparent;color:var(--white-text);font-family:var(--font-mono)}
13
13
  button{cursor:pointer}
14
- .widget-window{position:relative;width:100%;height:100%;display:flex;flex-direction:column;background:var(--bg-color);border:2px solid var(--red-color);border-radius:8px;overflow:hidden;-webkit-app-region:drag}
14
+ .widget-window{position:relative;width:100%;height:100%;display:flex;flex-direction:column;background:var(--bg-color);border:2px solid var(--red-color);border-radius:0;overflow:hidden;-webkit-app-region:drag}
15
15
  .title-bar{padding:6px 10px 4px;display:flex;align-items:center;gap:7px;border-bottom:1px solid var(--red-color)}
16
16
  .dot{width:12px;height:12px;border-radius:50%;border:1px solid var(--red-color);background:transparent}
17
17
  .dot.filled{background-color:var(--red-color)}
@@ -1,6 +1,7 @@
1
1
  import fs from 'node:fs';
2
2
  import {spawn} from 'node:child_process';
3
3
  import {app, BrowserWindow, dialog, ipcMain, nativeTheme} from 'electron';
4
+ import {ICON_PATH, nameApp, showAppIcon} from './app-identity.mjs';
4
5
  import path from 'node:path';
5
6
  import {fileURLToPath} from 'node:url';
6
7
  import {describeProjects, listProjectRecords, registerNewProjects, removeProject, resolveInitialProjectSuggestion} from './runtime.mjs';
@@ -136,7 +137,10 @@ function setupWindowOptions(platform) {
136
137
  };
137
138
  }
138
139
 
140
+ nameApp(app);
141
+
139
142
  app.whenReady().then(() => {
143
+ showAppIcon(app);
140
144
  if (!gotSingleInstanceLock) {
141
145
  return;
142
146
  }
@@ -146,7 +150,7 @@ app.whenReady().then(() => {
146
150
  if (platform === 'darwin') {
147
151
  app.dock?.hide();
148
152
  }
149
- window = new BrowserWindow(setupWindowOptions(platform));
153
+ window = new BrowserWindow({...setupWindowOptions(platform), icon: ICON_PATH});
150
154
  keepWindowOnItsPage(window);
151
155
  // Project records carry absolute paths: only Welcome's own page gets them.
152
156
  ipcMain.handle('kitcode:onboarding-initial-state', (event) => {