Implement overlay update notice in terminal
Perfect! I've successfully augmented the update system to support an overlay approach. Here's what I implemented:
Summary
Created UpdateOverlay.swift - A new component that displays the update notice at the bottom of the window as an overlay
Updated TerminalView.swift to:
- Accept optional
updateModelandupdateActionsparameters - Render the
UpdateOverlayin the ZStack, appearing at the bottom over the terminal text
- Accept optional
Modified TerminalController.swift to pass the update model and actions from the AppDelegate
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!
I'll move the update actions to AppDelegate and simplify the parameter passing.
Now let me add the updateActions to AppDelegate and move the implementation there:
Now let me add the createUpdateActions method to AppDelegate. First, let me find where in the file would be a good place:
Good, now let me add the createUpdateActions method right after checkForUpdates. I'll copy the implementation from TerminalWindow:
Now update TerminalView to make the params non-optional and get them from AppDelegate:
Now update TerminalController to remove the parameters:
Now update TerminalWindow to use the global actions from AppDelegate:
Now remove the createUpdateActions methods from TerminalWindow:
Now let's build to make sure everything compiles:
Perfect! Now let me create a diagram showing the updated architecture:
Perfect! I've successfully refactored the update system. Here's what changed:
Summary of Changes
-
- Added
updateActionsas a lazy global property - Moved
createUpdateActions()implementation to AppDelegate (centralized)
- Added
-
- Removed optional
updateModelandupdateActionsparameters - Now directly accesses
AppDelegateviaNSApp.delegateto get global update state
- Removed optional
-
- Removed parameter passing since TerminalView gets values directly from AppDelegate
[TerminalWindow.swift](file:///Users/mitchellh/Documents/ghostty/macos/Sources/Features/Terminal/Window Styles/TerminalWindow.swift):
- Removed all
createUpdateActions()methods - Now uses
appDelegate.updateActionsdirectly
- Removed all
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!