mirror of
https://github.com/wez/wezterm.git
synced 2024-12-21 04:11:44 +03:00
b224aa1b56
This took a decent amount of effort to thread through with context; wrappers around NSMenu and NSMenuItem are added to reduce some of the objc usability warts, and an additional NSObject wrapper is added to help copy the KeyAssignment from the existing list of command palette commands and associate it with the menu item. When a menu item is selected, macOS will walk through the responder chain and look for a responder that responds to the selector associated with the menu item. In practice that means that our window/view class will be tried first, and then later, our app delegate will be tried. This commit implements routing from both of these: the window case routes to the associated TermWindow and drops into the existing perform_key_assignment method. In case there is no window (not currently possible, but will be in the future), the app delegate also has a placeholder for dispatching key assignments, although it will only be able to perform a subset of the possible actions. A couple of things to note: * Items aren't smart enough to disable themselves or adjust their caption based on the context. To make that work, we either need to recreate the entire menubar when any possible context changes (doable, but feels heavy), or we need to assign a target to each menu item and implement a validation handler on that target. That seemed to mess with the responder chain when I briefly experimented with it. * There's some disabled code to add a Services menu. It is disabled because when it is enabled, accessing either Services or Help from the menu bar sends the process into a busy loop somewhere in macOS's internals. It's unclear what it is unhappy with. * No keyboard accelerators are associated with the menubar yet. That needs some thought, as they would essentially become global keyboard shortcuts and take precedence over the shortcuts defined for other keys in the config. This feels like it should be something that the user has control over, so there needs to be something to allow that before we go ahead and wire those up. refs: https://github.com/wez/wezterm/issues/162 refs: https://github.com/wez/wezterm/issues/1485 |
||
---|---|---|
.. | ||
src | ||
build.rs | ||
Cargo.toml |