Skip to content

Commit 020d8ba

Browse files
committed
configurable themes
1 parent 7c1a97e commit 020d8ba

File tree

4 files changed

+374
-10
lines changed

4 files changed

+374
-10
lines changed

index.html

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
<div class="sidebar">
2020
<div class="sidebar-header">
2121
<h1 class="sidebar-title">FleetCode</h1>
22+
<button id="open-settings" class="settings-btn" title="Settings">⚙️</button>
2223
</div>
2324

2425
<div class="sidebar-content">
@@ -169,6 +170,57 @@ <h2 class="modal-title">Add MCP Server</h2>
169170
</div>
170171
</div>
171172

173+
<!-- Settings Modal -->
174+
<div id="settings-modal" class="modal-overlay hidden">
175+
<div class="modal">
176+
<h2 class="modal-title">Terminal Settings</h2>
177+
178+
<div class="form-group">
179+
<label class="form-label">Theme</label>
180+
<select id="settings-theme" class="form-select">
181+
<option value="macos-light">macOS Terminal (Light)</option>
182+
<option value="macos-dark">macOS Terminal (Dark)</option>
183+
<option value="solarized-dark">Solarized Dark</option>
184+
<option value="dracula">Dracula</option>
185+
<option value="one-dark">One Dark</option>
186+
<option value="github-dark">GitHub Dark</option>
187+
</select>
188+
</div>
189+
190+
<div class="form-group">
191+
<label class="form-label">Font Family</label>
192+
<select id="settings-font-family" class="form-select">
193+
<option value="Menlo, Monaco, 'Courier New', monospace">Menlo</option>
194+
<option value="'SF Mono', Monaco, 'Courier New', monospace">SF Mono</option>
195+
<option value="Monaco, 'Courier New', monospace">Monaco</option>
196+
<option value="'Courier New', Courier, monospace">Courier New</option>
197+
<option value="'Source Code Pro', monospace">Source Code Pro</option>
198+
<option value="'Fira Code', monospace">Fira Code</option>
199+
<option value="'JetBrains Mono', monospace">JetBrains Mono</option>
200+
<option value="Consolas, monospace">Consolas</option>
201+
</select>
202+
</div>
203+
204+
<div class="form-group">
205+
<label class="form-label">Font Size</label>
206+
<input type="number" id="settings-font-size" class="form-input" min="8" max="32" placeholder="11" />
207+
</div>
208+
209+
<div class="form-group">
210+
<label class="flex items-center space-x-2 cursor-pointer">
211+
<input type="checkbox" id="settings-cursor-blink" class="form-checkbox" />
212+
<span class="text-sm text-gray-300">Cursor Blink</span>
213+
</label>
214+
</div>
215+
216+
<div class="btn-group">
217+
<button id="cancel-settings" class="btn-secondary">Cancel</button>
218+
<button id="reset-settings" class="btn-secondary">Reset to Default</button>
219+
<button id="save-settings" class="btn-primary">Save</button>
220+
</div>
221+
</div>
222+
</div>
223+
172224
<script>
173225
require('./dist/renderer.js');
174226
</script>

main.ts

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,10 @@ ipcMain.on("create-session", async (event, config: SessionConfig) => {
212212
let dataBuffer = "";
213213

214214
ptyProcess.onData((data) => {
215-
mainWindow.webContents.send("session-output", sessionId, data);
215+
// Only send data if window still exists and is not destroyed
216+
if (mainWindow && !mainWindow.isDestroyed()) {
217+
mainWindow.webContents.send("session-output", sessionId, data);
218+
}
216219

217220
// Detect when terminal is ready
218221
if (!terminalReady) {
@@ -309,7 +312,10 @@ ipcMain.on("reopen-session", (event, sessionId: string) => {
309312
let dataBuffer = "";
310313

311314
ptyProcess.onData((data) => {
312-
mainWindow.webContents.send("session-output", sessionId, data);
315+
// Only send data if window still exists and is not destroyed
316+
if (mainWindow && !mainWindow.isDestroyed()) {
317+
mainWindow.webContents.send("session-output", sessionId, data);
318+
}
313319

314320
// Detect when terminal is ready and auto-run agent
315321
if (!terminalReady) {
@@ -389,6 +395,15 @@ ipcMain.on("rename-session", (_event, sessionId: string, newName: string) => {
389395
}
390396
});
391397

398+
// Terminal settings handlers
399+
ipcMain.handle("get-terminal-settings", () => {
400+
return (store as any).get("terminalSettings");
401+
});
402+
403+
ipcMain.handle("save-terminal-settings", (_event, settings: any) => {
404+
(store as any).set("terminalSettings", settings);
405+
});
406+
392407
// MCP Server management functions
393408
async function listMcpServers() {
394409
try {
@@ -529,6 +544,19 @@ const createWindow = () => {
529544
const sessions = getPersistedSessions();
530545
mainWindow.webContents.send("load-persisted-sessions", sessions);
531546
});
547+
548+
// Clean up PTY processes when window is closed
549+
mainWindow.on("closed", () => {
550+
// Kill all active PTY processes
551+
activePtyProcesses.forEach((ptyProcess, sessionId) => {
552+
try {
553+
ptyProcess.kill();
554+
} catch (error) {
555+
console.error(`Error killing PTY for session ${sessionId}:`, error);
556+
}
557+
});
558+
activePtyProcesses.clear();
559+
});
532560
};
533561

534562
app.whenReady().then(() => {

0 commit comments

Comments
 (0)