Add full-featured Window menu with tiling window manager support#21
Conversation
|
Thanks for your contribution. I'm a first time ObjC'er too, so no worries there. I like the idea of a "Window" menu, though it may confuse Emacs users relative to Emacs' own definition of "windows". I wonder, does it have to be called "Window"? For shortcuts, do you mean binding these in Settings' Let me play around with this. |
|
@jdtsmith thanks, yeah, I agree that having a "Window" menubar could be confusing for emacs user. Some ideas... Option 1 -- Change the nameI can suggest "Tiling" or symbols that represent graphical tiling: 🪟, ⊞, Option 2 -- Nest this menu under "Emacs"I've put up a separate PR for this: #23 By nesting this under the "Emacs" menu item, this conveys the expectation that this is an apple-specific feature. Screenshot:
I personally would lean towards Option 2 to keep the menu bar tidy. |
|
Out of the box, I couldn't find anything that sets this up. Here are upstream docs for configuring menus, and all the menus are already configured in macappkit.m for mainMenu, servicesMenu, windowsMenu. I played around a bit with tabs and it appears that emacs-mac treats each tab as a separate window. You get names of tabs for free ... but you do not get any controls for changing tabs.
I looked at a few apps (Firefox, Signal). I believe the apps with extra Window items customize this explicitly. For example, here's the code for kitty that produces the menu. |
|
@jdtsmith yeah, I noticed that. The configuration for these four commands are encoded in elisp, see emacs-mac/lisp/term/mac-win.el Lines 3092 to 3105 in 2226fd6 I think this is doable, however I'd tackle it differently from what I have now. I will try the following:
I can give this a try |
|
Excellent, thank you for looking into this. Also, if you discover things about the interface between system-provided menus and elisp-defined menus (like how that works in general), it would be great to take some notes about it in the |
|
@jdtsmith ready for another round of review. Here's a screenshot of this the new Window menu with this patch:
|
jdtsmith
left a comment
There was a problem hiding this comment.
This is looking good, thanks, just a few things to look at. I notice many Window menus have an item "Bring All to Front". That would be good to have too, if it's straightforward. Thanks again for your work on this.
|
This is really cool! |
|
@rymndhng any progress? Would be great to land this and then port to our master-branch tracking build. |
|
Been a bit busy recently. I’ll try to get back to it sometime this weekend. I can rebase this off the base branch before applying your feedback. |
|
No worries, thanks for working on it. Shouldn't be any changes to worry about. |
cae800a to
ca5b262
Compare
|
@jdtsmith This is ready for review again. I also fixed up a bug with localizing the Edit menu. On a mac, you can test the localization on individual apps under "Languages & Region > Applications". Here's a screenshot of Emacs Menubar in German ... also see that "Edit" is translated now.
|
I haven't figured out what enables this. I see it on many apps, but I also don't see it universally -- I don't see this on Firefox. |
|
I've tested this and it works great. I also figured out there's a responder action called If you give this a test and it works for you, I think we're ready to merge. Could you please squash all your commits but mine into one with a good commit message, and force push to this PR? Thanks again for working on this. |
The Window menu bar holds commands for managing window & tabs. Adopts commands found in most mac apps such as Fill, Center, Move & Resize. This allows Emacs to respond to native MacOS tiling keyboard shortcuts, see https://support.apple.com/en-ca/guide/mac-help/ mchl9674d0b0/mac. Additionally, we move custom tab actions from the 'Buffer' menu here. This is accomplished by placing these keybindings under the new `mac-window-menu-map`. Finally, we noticed the "Edit" menu item did not localize. This PR contains a fix for this. See jdtsmith#22
65eace4 to
20f8646
Compare
|
@jdtsmith looks good! I've squashed it down. |
|
Thanks again for your work on this! @simmsb would be good to merge this into the master tracking branch too. |
|
@jdtsmith thanks for the ping, I’ll take a look at it sometime this week. I have an older Ventura mac to test on. |










What works:
What's meh: