From 1f68cb8a5de45c8b697ca74085cd5aae2c361787 Mon Sep 17 00:00:00 2001 From: haoyuren <13851610112@163.com> Date: Fri, 13 Mar 2026 01:37:50 -0500 Subject: Update logo, app icon, fix shutdown crash, add README - Simplified logo: cosmic latte cup on brown background with turquoise liquid and sparkle stars - Square app icon (.icns) for macOS dock - Fix crash on window close: guard all IPC sends against destroyed window - Include ws/chokidar/diff-match-patch in packaged app - Add README with features and install instructions Co-Authored-By: Claude Opus 4.6 --- README.md | 50 +++++++++++++++++++++++++++++++++++++++++++++++ electron-builder.yml | 20 +++++++++++++++++++ resources/icon.icns | Bin 0 -> 168312 bytes resources/logo.svg | 35 +++++++++++---------------------- src/main/index.ts | 28 ++++++++++++++++---------- src/renderer/src/App.css | 2 +- src/renderer/src/App.tsx | 21 ++++++++------------ 7 files changed, 108 insertions(+), 48 deletions(-) create mode 100644 README.md create mode 100644 resources/icon.icns diff --git a/README.md b/README.md new file mode 100644 index 0000000..5bdaaa2 --- /dev/null +++ b/README.md @@ -0,0 +1,50 @@ +# LatteX + +

+ LatteX logo +

+ +

+ LaTeX editor with real-time Overleaf sync, themed in Cosmic Latte. +

+ +## Features + +- **Real-time Overleaf sync** — WebSocket-based OT collaboration, live co-editing +- **Bidirectional file sync** — edit `.tex` files on disk (e.g. with Claude Code in the integrated terminal) and changes sync to Overleaf automatically +- **Local LaTeX compilation** — compile PDFs locally with `latexmk`, no Overleaf compile limits +- **PDF viewer** — built-in viewer with SyncTeX forward/inverse search, pinch-to-zoom +- **LaTeX autocomplete** — commands, environments, `\ref`, `\cite`, file paths +- **Comments & review** — inline comment highlights with review panel +- **Collaborator cursors** — see other editors' positions in real-time +- **Project chat** — real-time chat panel +- **Integrated terminal** — built-in terminal for CLI tools + +## Install + +Download the latest `.dmg` from [Releases](https://github.com/YurenHao0426/lattex/releases). + +> **Note:** This is an unsigned build. On first launch, right-click → Open, or allow it in System Settings → Privacy & Security. + +### Requirements + +- macOS (Apple Silicon) +- [TeX Live](https://www.tug.org/texlive/) or [MacTeX](https://www.tug.org/mactex/) for local compilation + +## Development + +```bash +npm install +npm run dev +``` + +### Build + +```bash +npm run build +npx electron-builder --mac dmg +``` + +## License + +[AGPL-3.0](LICENSE) diff --git a/electron-builder.yml b/electron-builder.yml index 9152755..5d1d3b4 100644 --- a/electron-builder.yml +++ b/electron-builder.yml @@ -6,7 +6,27 @@ directories: files: - out/**/* - "!node_modules/**/*" + - node_modules/node-pty/**/* + - node_modules/ws/**/* + - node_modules/chokidar/**/* + - node_modules/diff-match-patch/**/* + - node_modules/anymatch/**/* + - node_modules/braces/**/* + - node_modules/fill-range/**/* + - node_modules/glob-parent/**/* + - node_modules/is-binary-path/**/* + - node_modules/is-extglob/**/* + - node_modules/is-glob/**/* + - node_modules/is-number/**/* + - node_modules/normalize-path/**/* + - node_modules/picomatch/**/* + - node_modules/readdirp/**/* + - node_modules/to-regex-range/**/* + - node_modules/binary-extensions/**/* +asarUnpack: + - node_modules/node-pty/**/* mac: + icon: resources/icon.icns target: - dmg category: public.app-category.productivity diff --git a/resources/icon.icns b/resources/icon.icns new file mode 100644 index 0000000..cf000bc Binary files /dev/null and b/resources/icon.icns differ diff --git a/resources/logo.svg b/resources/logo.svg index bd5af43..017bf65 100644 --- a/resources/logo.svg +++ b/resources/logo.svg @@ -1,28 +1,15 @@ - - - - - - - - - - - - + - - - - - - - + - - - - - + + + + + + + + + diff --git a/src/main/index.ts b/src/main/index.ts index b543b46..7fab07a 100644 --- a/src/main/index.ts +++ b/src/main/index.ts @@ -38,6 +38,13 @@ function createWindow(): void { } } +/** Safely send IPC to renderer — no-op if window is gone */ +function sendToRenderer(channel: string, ...args: unknown[]) { + if (mainWindow && !mainWindow.isDestroyed()) { + mainWindow.webContents.send(channel, ...args) + } +} + ipcMain.handle('fs:readFile', async (_e, filePath: string) => { return readFile(filePath, 'utf-8') }) @@ -99,11 +106,11 @@ ipcMain.handle('pty:spawn', async (_e, cwd: string) => { }) ptyInstance.onData((data) => { - mainWindow?.webContents.send('pty:data', data) + sendToRenderer('pty:data', data) }) ptyInstance.onExit(() => { - mainWindow?.webContents.send('pty:exit') + sendToRenderer('pty:exit') }) }) @@ -602,7 +609,7 @@ ipcMain.handle('ot:connect', async (_e, projectId: string) => { // Relay events to renderer overleafSock.on('connectionState', (state: string) => { - mainWindow?.webContents.send('ot:connectionState', state) + sendToRenderer('ot:connectionState', state) }) // otUpdateApplied: server acknowledges our op (ack signal for OT client) @@ -610,13 +617,13 @@ ipcMain.handle('ot:connect', async (_e, projectId: string) => { if (name === 'otUpdateApplied') { const update = args[0] as { doc?: string; v?: number } | undefined if (update?.doc) { - mainWindow?.webContents.send('ot:ack', { docId: update.doc }) + sendToRenderer('ot:ack', { docId: update.doc }) } } }) overleafSock.on('docRejoined', (docId: string, result: JoinDocResult) => { - mainWindow?.webContents.send('ot:docRejoined', { + sendToRenderer('ot:docRejoined', { docId, content: result.docLines.join('\n'), version: result.version @@ -626,11 +633,11 @@ ipcMain.handle('ot:connect', async (_e, projectId: string) => { // Relay collaborator cursor updates to renderer overleafSock.on('serverEvent', (name: string, args: unknown[]) => { if (name === 'clientTracking.clientUpdated') { - mainWindow?.webContents.send('cursor:remoteUpdate', args[0]) + sendToRenderer('cursor:remoteUpdate', args[0]) } else if (name === 'clientTracking.clientDisconnected') { - mainWindow?.webContents.send('cursor:remoteDisconnected', args[0]) + sendToRenderer('cursor:remoteDisconnected', args[0]) } else if (name === 'new-chat-message') { - mainWindow?.webContents.send('chat:newMessage', args[0]) + sendToRenderer('chat:newMessage', args[0]) } }) @@ -705,7 +712,7 @@ ipcMain.handle('ot:joinDoc', async (_e, docId: string) => { if (name === 'otUpdateApplied') { const update = args[0] as { doc?: string; op?: unknown[]; v?: number } | undefined if (update?.doc === docId && update.op) { - mainWindow?.webContents.send('ot:remoteOp', { + sendToRenderer('ot:remoteOp', { docId: update.doc, ops: update.op, version: update.v @@ -1000,7 +1007,7 @@ ipcMain.handle('overleaf:socketCompile', async (_e, mainTexRelPath: string) => { await compilationManager.syncBinaries(fileRefs) return compilationManager.compile(mainTexRelPath, (data) => { - mainWindow?.webContents.send('latex:log', data) + sendToRenderer('latex:log', data) }) }) @@ -1023,6 +1030,7 @@ app.whenReady().then(async () => { }) app.on('window-all-closed', () => { + mainWindow = null ptyInstance?.kill() fileSyncBridge?.stop() fileSyncBridge = null diff --git a/src/renderer/src/App.css b/src/renderer/src/App.css index 760c333..cbf0282 100644 --- a/src/renderer/src/App.css +++ b/src/renderer/src/App.css @@ -102,7 +102,7 @@ html, body, #root { .lattex-x { font-weight: 800; font-style: italic; - color: var(--accent-blue); + color: #4ECDA0; } .welcome-content p { diff --git a/src/renderer/src/App.tsx b/src/renderer/src/App.tsx index 88a351b..3259f0d 100644 --- a/src/renderer/src/App.tsx +++ b/src/renderer/src/App.tsx @@ -291,19 +291,14 @@ export default function App() {
- - - - - - - - - - - - - + + + + + + + +

LatteX

-- cgit v1.2.3