Skip to content

Commit 991c9eb

Browse files
kimjoin2claude
andauthored
feat: (GUI) Dynamic app metadata configuration from package.json (#27)
* feat: add dynamic app configuration and macOS About panel support - Set app name dynamically from package.json (productName or name field) - Add About panel options with version, author, and homepage from package.json - Configure app name before app ready for proper macOS menu bar display - Centralize all app metadata in package.json for easier maintenance 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * fix: replace require() with ES6 import for package.json in main.ts Resolves @typescript-eslint/no-var-requires error by changing `const packageJson = require('../package.json');` to `import packageJson from '../package.json';` 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * fix: resolve TypeScript compilation errors in main.ts - Remove non-existent packageJson.productName reference on line 11 - Fix author field type handling on line 262 to properly handle string or object types These fixes resolve TypeScript errors that were preventing successful compilation. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent fdd2a55 commit 991c9eb

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/main.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,15 @@ import { app, BrowserWindow, ipcMain, screen, Menu, Tray, nativeImage } from 'el
22
import * as path from 'path';
33
import { exec } from 'child_process';
44
import { promisify } from 'util';
5+
import packageJson from '../package.json';
56

67
const execAsync = promisify(exec);
78

9+
// Set app name before app is ready (important for macOS)
10+
// Use productName from package.json if available, otherwise use name
11+
const appName = packageJson.build?.productName || packageJson.name || 'CCUsage Widget';
12+
app.setName(appName);
13+
814
// Helper function to extract session name from sessionId
915
function extractSessionNameFromId(sessionId: string): string {
1016
if (!sessionId) return 'session';
@@ -246,6 +252,19 @@ function updatePosition(position: WidgetConfig['position']) {
246252
}
247253

248254
app.whenReady().then(() => {
255+
256+
// Set About panel options for macOS
257+
app.setAboutPanelOptions({
258+
applicationName: appName,
259+
applicationVersion: packageJson.version,
260+
version: packageJson.version,
261+
copyright: 'Copyright © 2025 JeongJaeSoon',
262+
authors: packageJson.author ?
263+
[typeof packageJson.author === 'string' ? packageJson.author : packageJson.author.name || 'JeongJaeSoon'] :
264+
['JeongJaeSoon'],
265+
website: packageJson.homepage || 'https://github.com/JeongJaeSoon/ccusage-widget'
266+
});
267+
249268
createWindow();
250269
createTray();
251270

0 commit comments

Comments
 (0)