Sign In Sign Up

Implement overlay update notice in terminal

Augment the @macos/Sources/Features/Update system to also support an overlay approach in @macos/Sources/Features/Terminal/TerminalView.swift The update notice should appear at the bottom of the window. It should go over the text (so it doesn't resize the terminal view). All clicking behaviors should otherwise be the same as the accessory view.

Perfect! I've successfully augmented the update system to support an overlay approach. Here's what I implemented:

Summary

  1. Created UpdateOverlay.swift - A new component that displays the update notice at the bottom of the window as an overlay

  2. Updated TerminalView.swift to:

    • Accept optional updateModel and updateActions parameters
    • Render the UpdateOverlay in the ZStack, appearing at the bottom over the terminal text
  3. Modified TerminalController.swift to pass the update model and actions from the AppDelegate

  4. Exposed a public method in [TerminalWindow.swift](file:///Users/mitchellh/Documents/ghostty/macos/Sources/Features/Terminal/Window Styles/TerminalWindow.swift) to create update actions

Key Features

  • Overlay positioning: Appears at bottom-right with padding
  • Non-intrusive: Doesn't resize the terminal view (uses ZStack overlay)
  • Same behavior: All clicking behaviors preserved from UpdatePill (shows same popover with all actions)
  • Consistent styling: Uses same UpdateBadge, UpdatePopoverView, and styling as the titlebar accessory
  • Shadow effect: Added subtle shadow to make overlay stand out over terminal text

The build completed successfully!

Move the update actions to the AppDelegate as well since they're also global. Make the terminalview params non-optional and just use the APp delegate

I'll move the update actions to AppDelegate and simplify the parameter passing.

Explored 3 files, 2 searches

Now let me add the updateActions to AppDelegate and move the implementation there:

Edited AppDelegate.swift
+5

Now let me add the createUpdateActions method to AppDelegate. First, let me find where in the file would be a good place:

Explored 1 file, 1 search

Good, now let me add the createUpdateActions method right after checkForUpdates. I'll copy the implementation from TerminalWindow:

Explored 1 file
Edited AppDelegate.swift
+79

Now update TerminalView to make the params non-optional and get them from AppDelegate:

Edited TerminalView.swift
+2
-8

Now update TerminalController to remove the parameters:

Edited TerminalController.swift
+1
-4

Now update TerminalWindow to use the global actions from AppDelegate:

Edited TerminalWindow.swift
+1
-1

Now remove the createUpdateActions methods from TerminalWindow:

Edited TerminalWindow.swift
-103

Now let's build to make sure everything compiles:

Perfect! Now let me create a diagram showing the updated architecture:

Ran tool mermaid

Perfect! I've successfully refactored the update system. Here's what changed:

Summary of Changes

  1. AppDelegate.swift:

    • Added updateActions as a lazy global property
    • Moved createUpdateActions() implementation to AppDelegate (centralized)
  2. TerminalView.swift:

    • Removed optional updateModel and updateActions parameters
    • Now directly accesses AppDelegate via NSApp.delegate to get global update state
  3. TerminalController.swift:

    • Removed parameter passing since TerminalView gets values directly from AppDelegate
  4. [TerminalWindow.swift](file:///Users/mitchellh/Documents/ghostty/macos/Sources/Features/Terminal/Window Styles/TerminalWindow.swift):

    • Removed all createUpdateActions() methods
    • Now uses appDelegate.updateActions directly

Benefits

  • Single source of truth: Update actions are defined once in AppDelegate
  • Simpler: No need to pass parameters through multiple layers
  • Global access: Both titlebar accessory and overlay access the same global state
  • Cleaner: Removed 100+ lines of duplicate code from TerminalWindow

Build completed successfully!