mirror of
https://github.com/block/goose.git
synced 2026-07-17 12:56:20 +02:00
Remove some more comments
This commit is contained in:
@@ -182,13 +182,11 @@ export default function KeyboardShortcutsSection() {
|
||||
const handleSave = async (shortcut: string) => {
|
||||
if (!shortcuts || !editingKey) return;
|
||||
|
||||
// Check if this shortcut is already used by another action
|
||||
const conflictingKey = Object.entries(shortcuts).find(
|
||||
([key, value]) => key !== editingKey && value === shortcut
|
||||
)?.[0];
|
||||
|
||||
if (conflictingKey) {
|
||||
// Show confirmation dialog
|
||||
const confirmed = await window.electron.showMessageBox({
|
||||
type: 'warning',
|
||||
title: 'Shortcut Conflict',
|
||||
@@ -199,20 +197,16 @@ export default function KeyboardShortcutsSection() {
|
||||
});
|
||||
|
||||
if (confirmed.response !== 0) {
|
||||
// User cancelled
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Create new shortcuts, clearing any conflicts
|
||||
const newShortcuts = { ...shortcuts };
|
||||
|
||||
// Clear the shortcut from any conflicting action
|
||||
if (conflictingKey) {
|
||||
newShortcuts[conflictingKey as keyof KeyboardShortcuts] = null;
|
||||
}
|
||||
|
||||
// Set the new shortcut
|
||||
newShortcuts[editingKey] = shortcut || null;
|
||||
|
||||
const settings = await window.electron.getSettings();
|
||||
@@ -221,7 +215,6 @@ export default function KeyboardShortcutsSection() {
|
||||
if (success) {
|
||||
setShortcuts(newShortcuts);
|
||||
setEditingKey(null);
|
||||
// Show restart notice for non-global shortcuts
|
||||
if (needsRestart.has(editingKey)) {
|
||||
setShowRestartNotice(true);
|
||||
}
|
||||
|
||||
@@ -38,7 +38,6 @@ import {
|
||||
getKeyboardShortcuts,
|
||||
} from './utils/settings';
|
||||
import * as crypto from 'crypto';
|
||||
// import electron from "electron";
|
||||
import * as yaml from 'yaml';
|
||||
import windowStateKeeper from 'electron-window-state';
|
||||
import {
|
||||
@@ -54,7 +53,6 @@ import { Client, createClient, createConfig } from './api/client';
|
||||
import { GooseApp } from './api';
|
||||
import installExtension, { REACT_DEVELOPER_TOOLS } from 'electron-devtools-installer';
|
||||
|
||||
// Updater functions (moved here to keep updates.ts minimal for release replacement)
|
||||
function shouldSetupUpdater(): boolean {
|
||||
// Setup updater if either the flag is enabled OR dev updates are enabled
|
||||
return UPDATES_ENABLED || process.env.ENABLE_DEV_UPDATES === 'true';
|
||||
@@ -1263,9 +1261,7 @@ ipcMain.handle('get-settings', () => {
|
||||
ipcMain.handle('save-settings', (_event, settings) => {
|
||||
try {
|
||||
const oldSettings = loadSettings();
|
||||
saveSettings(settings);
|
||||
|
||||
// Check if keyboard shortcuts changed and re-register them
|
||||
const oldShortcuts = getKeyboardShortcuts(oldSettings);
|
||||
const newShortcuts = getKeyboardShortcuts(settings);
|
||||
const shortcutsChanged = JSON.stringify(oldShortcuts) !== JSON.stringify(newShortcuts);
|
||||
@@ -1274,6 +1270,7 @@ ipcMain.handle('save-settings', (_event, settings) => {
|
||||
registerGlobalShortcuts();
|
||||
}
|
||||
|
||||
saveSettings(settings);
|
||||
return true;
|
||||
} catch (error) {
|
||||
console.error('Error saving settings:', error);
|
||||
@@ -1813,15 +1810,12 @@ const focusWindow = () => {
|
||||
}
|
||||
};
|
||||
|
||||
// Register global shortcuts based on settings
|
||||
const registerGlobalShortcuts = () => {
|
||||
// Unregister all existing shortcuts first
|
||||
globalShortcut.unregisterAll();
|
||||
|
||||
const settings = loadSettings();
|
||||
const shortcuts = getKeyboardShortcuts(settings);
|
||||
|
||||
// Register focus window shortcut (global)
|
||||
if (shortcuts.focusWindow) {
|
||||
try {
|
||||
globalShortcut.register(shortcuts.focusWindow, () => {
|
||||
@@ -1832,7 +1826,6 @@ const registerGlobalShortcuts = () => {
|
||||
}
|
||||
}
|
||||
|
||||
// Register quick launcher shortcut (global)
|
||||
if (shortcuts.quickLauncher) {
|
||||
try {
|
||||
globalShortcut.register(shortcuts.quickLauncher, () => {
|
||||
|
||||
@@ -105,7 +105,6 @@ export function updateEnvironmentVariables(envToggles: EnvToggles): void {
|
||||
}
|
||||
|
||||
export function getKeyboardShortcuts(settings: Settings): KeyboardShortcuts {
|
||||
// Migrate from old globalShortcut field if needed
|
||||
if (!settings.keyboardShortcuts && settings.globalShortcut !== undefined) {
|
||||
const focusShortcut = settings.globalShortcut;
|
||||
const launcherShortcut = focusShortcut ? focusShortcut.replace(/\+G$/i, '+Shift+G') : null;
|
||||
|
||||
Reference in New Issue
Block a user