Add interactive directory actions popover to status bar
Summary
This PR enhances the Current Directory widget in iTerm2's status bar with an interactive popover interface, similar to the existing Job Name widget functionality.
Changes
When clicking on the Current Directory status bar widget, users now see a popover with 5 useful actions:
- Copy Full Path - Copies the complete directory path to clipboard
- Copy Directory Name - Copies just the directory name (basename) to clipboard
- Reveal in Finder - Opens Finder and shows the directory
- Open in New Window - Opens a new iTerm2 window in that directory
- Open in New Tab - Opens a new tab in the current window in that directory
Implementation Details
- Created
iTermDirectoryActionsViewControllerfor the popover UI - Updated
iTermStatusBarWorkingDirectoryComponentto show popover on click - Proper dark mode support using
effectiveAppearance - Leverages
iTermSessionLauncherfor opening new windows/tabs - Follows existing code patterns from the Job Name widget
Testing
The feature has been implemented following iTerm2's existing patterns and should work seamlessly with both light and dark modes.
Screenshots
The popover provides a clean, native macOS interface that matches iTerm2's visual style and adapts to the current appearance mode.
If you want to change only Current Directory then you should modify iTermStatusBarWorkingDirectoryComponent, not iTermStatusBarVariableBaseComponent. I don't think these actions make sense for other subclasses of iTermStatusBarVariableBaseComponent like username and hostname.
Also, why not stick with the existing NSMenu? It has the benefit of allowing mouse-down+drag and is a more consistent look with other components that show menus on click (git, actions, and snippets).
@gnachman Like this?
@gnachman Thanks, I will check this.
I'm not sure what I'm doing here, but I do feel it's frustrating not having any action on that widget. We are missing an opportunity here.
If you have any good idea, happy to implement it.
Done! Changed both methods to use the mutable profile copy pattern with KEY_WORKING_DIRECTORY and KEY_CUSTOM_DIRECTORY. Thanks for the feedback!
I would just put this in an NSMenu instead of creating a whole new view controller by adding it to the existing openMenuWithView: method.