Druid: Figure out how dictation/emoji menu items work

Created on 13 Oct 2020  路  10Comments  路  Source: linebender/druid

Not sure whether it fits here, but on Mac the "Quit" entry should be last. While on Mac Rundender it is the 3rd last.

Bildschirmfoto 2020-10-13 um 20 57 41

_Originally posted by @kud1ing in https://github.com/linebender/druid/issue_comments/707944931_

bug shelmac

All 10 comments

Thanks. As noted in the referenced thread, the last two entries should be under the Edit menu.

I can reproduce. These two items are dynamically added to our menu by AppKit, and they're putting them in the wrong place; I really don't know much more than that at the moment.

Druid's "quit" example shows this behaviour already (while slightly different):

Bildschirmfoto 2020-10-13 um 23 30 59

https://blog.rachelbrindle.com/2015/08/14/osx-programming-programmatic-menu-buttons/ says

There are quite a few gotcha鈥檚 to adding things to the global menu.
First is that every NSMenuItem and NSMenu you add needs to have the title property set,
otherwise they won鈥檛 be visible.

So if i do both:

let () = msg_send![menu.menu, setTitle: menu_item_title];
let () = msg_send![menu_item, setTitle: menu_item_title];

then it does not look too bad (i've added an empty "Edit" menu myself):

Bildschirmfoto 2020-11-06 um 21 20 15

Bildschirmfoto 2020-11-06 um 21 20 20

Notice that "Start Dictation ..." is missing, so this solution is not yet perfect.

And as a bonus, if you add an empty "View" menu, there are more automagical entries:

Bildschirmfoto 2020-11-06 um 21 24 31

For reference, here is how Cacao does it:

The difference is that Druid's Menu does not have a title.

@cmyr : Oh, you've removed the setting of the menu time title in https://github.com/linebender/druid/commit/e47b335709f17357f79e2232980d713e2a08d56c

Bildschirmfoto 2020-11-07 um 11 48 09

Do you remember why?

I don't remember exactly, except that I remember there being some weirdness when the top-level menu (which is basically the menubar itself?) had a name? But I did not research this is thoroughly as you are doing.

In this case, maybe one could just disable that for the main menu, by comparing the menu with NSApplication:: mainMenu().

Was this page helpful?
0 / 5 - 0 ratings

Related issues

thePalindrome picture thePalindrome  路  3Comments

MGlolenstine picture MGlolenstine  路  3Comments

Finnerale picture Finnerale  路  3Comments

bheisler picture bheisler  路  5Comments

cmyr picture cmyr  路  3Comments