Skip to main content

Overview

Window management IPC methods control the visibility, position, and behavior of various application windows including the main menu, settings panel, brain panel, and suggestion windows.

Window Control Methods

closeMenu

Closes the main menu window. Parameters: None Returns: void (one-way message) Implementation: frontend/electron/src/ipc/window-handlers.ts:35
// Close the menu window
window.electron.closeMenu();

Behavior

Hides the main application window (AppState.mainWindow) from view. The window is not destroyed, only hidden, allowing it to be shown again quickly.

resizeWindow

Resizes the current window to the specified dimensions.
size
object
required
Object containing optional width and height properties
size.width
number
New window width in pixels (optional)
size.height
number
New window height in pixels (optional)
Returns: void (one-way message) Implementation: frontend/electron/src/ipc/window-handlers.ts:39
// Resize to specific dimensions
window.electron.resizeWindow({ width: 800, height: 600 });

// Only change width
window.electron.resizeWindow({ width: 1000 });

// Only change height
window.electron.resizeWindow({ height: 400 });

Behavior

Resizes the main window while preserving:
  • Current window position (x, y coordinates)
  • Unspecified dimensions (width or height if not provided)

moveWindow

Moves the window by a relative offset from its current position.
delta
object
required
Object containing x and y offset values
delta.x
number
required
Horizontal offset in pixels (positive = right, negative = left)
delta.y
number
required
Vertical offset in pixels (positive = down, negative = up)
Returns: void (one-way message) Implementation: frontend/electron/src/ipc/window-handlers.ts:50
// Move window 100px to the right and 50px down
window.electron.moveWindow({ x: 100, y: 50 });

// Move window to the left and up
window.electron.moveWindow({ x: -50, y: -30 });

Behavior

Moves the window relative to its current position while preserving:
  • Window dimensions (width and height)
  • Current window state (minimized, maximized, etc.)

openSettings

Opens the settings window. Parameters: None Returns: void (one-way message) Implementation: frontend/electron/src/ipc/window-handlers.ts:27
// Open settings window
window.electron.openSettings();

Behavior

Creates and displays a new settings window. If a settings window already exists, it will be brought to focus.

Brain Panel Methods

The brain panel is a utility window that displays captured context and memories.

toggleBrainPanel

Toggles the brain panel window visibility. Parameters: None Returns: void (one-way message) Implementation: frontend/electron/src/ipc/window-handlers.ts:7
// Toggle brain panel on/off
window.electron.toggleBrainPanel();

Behavior

  • If the brain panel is visible, it will be hidden
  • If the brain panel is not visible, it will be created and shown
  • The panel appears in the top-right corner of the screen

setBrainPanelCollapsed

Sets the brain panel to collapsed or expanded state.
collapsed
boolean
required
Whether the brain panel should be collapsed
  • true - Collapse to 60x60px mini icon
  • false - Expand to 320x400px full panel
Returns: void (one-way message) Implementation: frontend/electron/src/ipc/window-handlers.ts:16
// Collapse brain panel to icon
window.electron.setBrainPanelCollapsed(true);

// Expand brain panel to full size
window.electron.setBrainPanelCollapsed(false);

Dimensions

Collapsed:
  • Size: 60x60 pixels
  • Position: 20px from top, 80px from right edge
Expanded:
  • Size: 320x400 pixels
  • Position: 20px from top, 340px from right edge

External Navigation

openExternal

Opens a URL in the system’s default web browser.
url
string
required
The URL to open in the default browser
Returns: void (one-way message) Implementation: frontend/electron/src/ipc/window-handlers.ts:31
// Open documentation in browser
window.electron.openExternal("https://docs.tabbyml.com");

Security

This method uses Electron’s shell.openExternal() which:
  • Opens URLs in the system’s default browser (not in Electron)
  • Respects system security settings
  • Shows security warnings for non-http(s) protocols

Window Event Listeners

onMemoryStored

Called when a new memory is captured and stored.
callback
(memory: string) => void
required
Function to call when memory is stored
  • memory - The captured memory text
Returns: () => void - Cleanup function to remove the listener Implementation: frontend/electron/src/preload.ts:35
useEffect(() => {
  const cleanup = window.electron.onMemoryStored((memory: string) => {
    console.log("New memory stored:", memory);
    // Update UI to show new memory
  });

  return cleanup; // Remove listener on unmount
}, []);

onCaptureStatusChanged

Called when the context capture feature is enabled or disabled.
callback
(enabled: boolean) => void
required
Function to call when capture status changes
  • enabled - Whether context capture is now enabled
Returns: () => void - Cleanup function to remove the listener Implementation: frontend/electron/src/preload.ts:41
useEffect(() => {
  const cleanup = window.electron.onCaptureStatusChanged((enabled: boolean) => {
    console.log("Context capture is now:", enabled ? "ON" : "OFF");
    // Update UI toggle state
  });

  return cleanup;
}, []);

Build docs developers (and LLMs) love