Skip to content

Commit 05e36ed

Browse files
committed
Fix for menu tray
1 parent fa84541 commit 05e36ed

5 files changed

Lines changed: 46 additions & 37 deletions

File tree

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# Dependencies
22
node_modules/
33

4+
# Claude Code local settings
5+
.claude/
6+
47
# Build outputs
58
dist/
69
dist-electron/

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2025 Anthropic
3+
Copyright (c) 2026 Steve Smith
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ A Tamagotchi-style virtual pet that lives in your menubar and tracks your Claude
2121

2222
### Download (Recommended)
2323

24-
Download the latest `.dmg` from the [Releases](https://github.com/anthropics/clawdgotchi/releases) page.
24+
Download the latest `.dmg` from the [Releases](https://github.com/stevysmith/clawdgotchi/releases) page.
2525

2626
### Build from Source
2727

2828
```bash
2929
# Clone the repo
30-
git clone https://github.com/anthropics/clawdgotchi.git
30+
git clone https://github.com/stevysmith/clawdgotchi.git
3131
cd clawdgotchi
3232

3333
# Install dependencies

electron/main.ts

Lines changed: 36 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { app, BrowserWindow, Tray, nativeImage, ipcMain, screen } from 'electron'
1+
import { app, BrowserWindow, Tray, nativeImage, ipcMain } from 'electron'
22
import * as path from 'path'
33
import { execSync } from 'child_process'
44
import * as fs from 'fs'
@@ -11,11 +11,10 @@ let mainWindow: BrowserWindow | null = null
1111
let socketServer: SocketServer | null = null
1212
let sessionManager: SessionManager | null = null
1313

14-
const isDev = process.env.NODE_ENV !== 'production' || !app.isPackaged
15-
1614
// Get the path to the menubar icon (Template version for auto dark/light mode)
1715
function getTrayIconPath(): string {
18-
if (isDev) {
16+
// Check app.isPackaged at runtime, not module load time
17+
if (!app.isPackaged) {
1918
// In development, use the assets folder directly
2019
return path.join(__dirname, '../assets/icons/build/menubar-iconTemplate.png')
2120
} else {
@@ -24,18 +23,16 @@ function getTrayIconPath(): string {
2423
}
2524
}
2625

26+
2727
// Create tray icon from file (macOS Template icons auto-adapt to dark/light mode)
2828
function createTrayIcon() {
2929
const iconPath = getTrayIconPath()
3030
const icon = nativeImage.createFromPath(iconPath)
31-
// Mark as template for macOS dark/light mode support
3231
icon.setTemplateImage(true)
3332
return icon
3433
}
3534

3635
function createWindow() {
37-
const { width: screenWidth } = screen.getPrimaryDisplay().workAreaSize
38-
3936
mainWindow = new BrowserWindow({
4037
width: 320,
4138
height: 400,
@@ -52,7 +49,7 @@ function createWindow() {
5249
},
5350
})
5451

55-
if (isDev) {
52+
if (!app.isPackaged) {
5653
mainWindow.loadURL('http://localhost:5173')
5754
// mainWindow.webContents.openDevTools({ mode: 'detach' })
5855
} else {
@@ -150,32 +147,40 @@ function getRepoHealth(): {
150147
}
151148

152149
app.whenReady().then(async () => {
153-
// Install Claude Code hooks
154-
await installHooks(isDev)
150+
try {
151+
// Install Claude Code hooks (don't block on failure)
152+
try {
153+
await installHooks(!app.isPackaged)
154+
} catch (e) {
155+
console.error('Hook installation failed:', e)
156+
}
155157

156-
// Create session manager
157-
sessionManager = new SessionManager()
158-
sessionManager.on('update', (sessions: Session[]) => {
159-
// Send update to renderer
160-
mainWindow?.webContents.send('sessions-updated', sessions)
158+
// Create session manager
159+
sessionManager = new SessionManager()
160+
sessionManager.on('update', (sessions: Session[]) => {
161+
// Send update to renderer
162+
mainWindow?.webContents.send('sessions-updated', sessions)
161163

162-
// Resize window based on session count
163-
resizeWindowForSessions(sessions.length)
164-
})
164+
// Resize window based on session count
165+
resizeWindowForSessions(sessions.length)
166+
})
165167

166-
// Create socket server and connect to session manager
167-
socketServer = new SocketServer()
168-
socketServer.on('event', (event) => {
169-
sessionManager?.handleEvent(event)
170-
})
171-
socketServer.start()
168+
// Create socket server and connect to session manager
169+
socketServer = new SocketServer()
170+
socketServer.on('event', (event) => {
171+
sessionManager?.handleEvent(event)
172+
})
173+
socketServer.start()
172174

173-
// Create tray icon
174-
tray = new Tray(createTrayIcon())
175-
tray.setToolTip('ClaudeGotchi')
176-
tray.on('click', toggleWindow)
175+
// Create tray icon
176+
tray = new Tray(createTrayIcon())
177+
tray.setToolTip('ClawdGotchi')
178+
tray.on('click', toggleWindow)
177179

178-
createWindow()
180+
createWindow()
181+
} catch (e) {
182+
console.error('App initialization failed:', e)
183+
}
179184

180185
// IPC handlers
181186
ipcMain.handle('get-health', () => {
@@ -222,7 +227,8 @@ app.on('will-quit', () => {
222227
sessionManager?.stop()
223228
})
224229

225-
app.on('activate', () => {
230+
app.on('activate', async () => {
231+
await app.whenReady()
226232
if (BrowserWindow.getAllWindows().length === 0) {
227233
createWindow()
228234
}

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
"name": "clawdgotchi",
33
"version": "0.1.0",
44
"description": "Your Claude Code companion - a Tamagotchi for developer hygiene",
5-
"author": "Anthropic",
5+
"author": "Steve Smith",
66
"license": "MIT",
7-
"homepage": "https://github.com/anthropics/clawdgotchi",
7+
"homepage": "https://github.com/stevysmith/clawdgotchi",
88
"repository": {
99
"type": "git",
10-
"url": "https://github.com/anthropics/clawdgotchi.git"
10+
"url": "https://github.com/stevysmith/clawdgotchi.git"
1111
},
1212
"bugs": {
13-
"url": "https://github.com/anthropics/clawdgotchi/issues"
13+
"url": "https://github.com/stevysmith/clawdgotchi/issues"
1414
},
1515
"keywords": [
1616
"claude",

0 commit comments

Comments
 (0)