fix __dirname is not defined

This commit is contained in:
Zane Staggs
2026-01-26 09:00:00 -08:00
parent cb0ee9ed90
commit 3a8f598306
6 changed files with 86 additions and 67 deletions
@@ -3,7 +3,7 @@ import { Switch } from '../../ui/switch';
import { Input } from '../../ui/input';
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '../../ui/card';
import { AlertCircle } from 'lucide-react';
import { ExternalGoosedConfig } from '../../../utils/settings';
import { ExternalGoosedConfig } from '../../../utils/settingsTypes';
const DEFAULT_CONFIG: ExternalGoosedConfig = {
enabled: false,
@@ -3,7 +3,7 @@ import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '../..
import { Button } from '../../ui/button';
import { Switch } from '../../ui/switch';
import { ShortcutRecorder } from './ShortcutRecorder';
import { KeyboardShortcuts, defaultKeyboardShortcuts } from '../../../utils/settings';
import { KeyboardShortcuts, defaultKeyboardShortcuts } from '../../../utils/settingsTypes';
import { trackSettingToggled } from '../../../utils/analytics';
interface ShortcutConfig {
@@ -1,6 +1,6 @@
import { useState, useEffect, useRef } from 'react';
import { Button } from '../../ui/button';
import { KeyboardShortcuts } from '../../../utils/settings';
import { KeyboardShortcuts } from '../../../utils/settingsTypes';
import { getShortcutLabel, formatShortcut } from './KeyboardShortcutsSection';
interface ShortcutRecorderProps {
+1 -1
View File
@@ -1,7 +1,7 @@
import Electron, { contextBridge, ipcRenderer, webUtils } from 'electron';
import { Recipe } from './recipe';
import { GooseApp } from './api';
import type { Settings } from './utils/settings';
import type { Settings } from './utils/settingsTypes';
interface NotificationData {
title: string;
+15 -63
View File
@@ -2,73 +2,25 @@ import { app } from 'electron';
import fs from 'fs';
import path from 'path';
export interface EnvToggles {
GOOSE_SERVER__MEMORY: boolean;
GOOSE_SERVER__COMPUTER_CONTROLLER: boolean;
}
// Re-export types and constants for backwards compatibility in main process
export type {
EnvToggles,
ExternalGoosedConfig,
KeyboardShortcuts,
Settings,
} from './settingsTypes';
export { defaultKeyboardShortcuts, defaultSettings } from './settingsTypes';
export interface ExternalGoosedConfig {
enabled: boolean;
url: string;
secret: string;
}
export interface KeyboardShortcuts {
focusWindow: string | null;
quickLauncher: string | null;
newChat: string | null;
newChatWindow: string | null;
openDirectory: string | null;
settings: string | null;
find: string | null;
findNext: string | null;
findPrevious: string | null;
alwaysOnTop: string | null;
}
type DefaultKeyboardShortcuts = {
[K in keyof KeyboardShortcuts]: string;
};
export interface Settings {
envToggles: EnvToggles;
showMenuBarIcon: boolean;
showDockIcon: boolean;
enableWakelock: boolean;
spellcheckEnabled: boolean;
externalGoosed?: ExternalGoosedConfig;
globalShortcut?: string | null; // Deprecated: use keyboardShortcuts.focusWindow
keyboardShortcuts?: KeyboardShortcuts;
}
import {
Settings,
KeyboardShortcuts,
EnvToggles,
defaultKeyboardShortcuts,
defaultSettings,
} from './settingsTypes';
const SETTINGS_FILE = path.join(app.getPath('userData'), 'settings.json');
export const defaultKeyboardShortcuts: DefaultKeyboardShortcuts = {
focusWindow: 'CommandOrControl+Alt+G',
quickLauncher: 'CommandOrControl+Alt+Shift+G',
newChat: 'CommandOrControl+T',
newChatWindow: 'CommandOrControl+N',
openDirectory: 'CommandOrControl+O',
settings: 'CommandOrControl+,',
find: 'CommandOrControl+F',
findNext: 'CommandOrControl+G',
findPrevious: 'CommandOrControl+Shift+G',
alwaysOnTop: 'CommandOrControl+Shift+T',
};
const defaultSettings: Settings = {
envToggles: {
GOOSE_SERVER__MEMORY: false,
GOOSE_SERVER__COMPUTER_CONTROLLER: false,
},
showMenuBarIcon: true,
showDockIcon: true,
enableWakelock: false,
spellcheckEnabled: true,
// globalShortcut is deprecated - not set in defaults, only kept in interface for backwards compatibility
keyboardShortcuts: defaultKeyboardShortcuts,
};
// Settings management
export function loadSettings(): Settings {
try {
+67
View File
@@ -0,0 +1,67 @@
// Shared types and constants that can be used in both main and renderer processes
// This file should NOT import any Node.js or Electron modules
export interface EnvToggles {
GOOSE_SERVER__MEMORY: boolean;
GOOSE_SERVER__COMPUTER_CONTROLLER: boolean;
}
export interface ExternalGoosedConfig {
enabled: boolean;
url: string;
secret: string;
}
export interface KeyboardShortcuts {
focusWindow: string | null;
quickLauncher: string | null;
newChat: string | null;
newChatWindow: string | null;
openDirectory: string | null;
settings: string | null;
find: string | null;
findNext: string | null;
findPrevious: string | null;
alwaysOnTop: string | null;
}
type DefaultKeyboardShortcuts = {
[K in keyof KeyboardShortcuts]: string;
};
export interface Settings {
envToggles: EnvToggles;
showMenuBarIcon: boolean;
showDockIcon: boolean;
enableWakelock: boolean;
spellcheckEnabled: boolean;
externalGoosed?: ExternalGoosedConfig;
globalShortcut?: string | null; // Deprecated: use keyboardShortcuts.focusWindow
keyboardShortcuts?: KeyboardShortcuts;
}
export const defaultKeyboardShortcuts: DefaultKeyboardShortcuts = {
focusWindow: 'CommandOrControl+Alt+G',
quickLauncher: 'CommandOrControl+Alt+Shift+G',
newChat: 'CommandOrControl+T',
newChatWindow: 'CommandOrControl+N',
openDirectory: 'CommandOrControl+O',
settings: 'CommandOrControl+,',
find: 'CommandOrControl+F',
findNext: 'CommandOrControl+G',
findPrevious: 'CommandOrControl+Shift+G',
alwaysOnTop: 'CommandOrControl+Shift+T',
};
export const defaultSettings: Settings = {
envToggles: {
GOOSE_SERVER__MEMORY: false,
GOOSE_SERVER__COMPUTER_CONTROLLER: false,
},
showMenuBarIcon: true,
showDockIcon: true,
enableWakelock: false,
spellcheckEnabled: true,
// globalShortcut is deprecated - not set in defaults, only kept in interface for backwards compatibility
keyboardShortcuts: defaultKeyboardShortcuts,
};