Re: [w3c/manifest] Feature Request: Shortcuts categories (#922)

> macOS send to have multiple collections, but I'm still looking for the documentation.

Yes, macOS does (sort of). The menus are called [Dock Menus](https://developer.apple.com/design/human-interface-guidelines/macos/menus/dock-menus/). A Dock Menu essentially is an [NSMenu](https://developer.apple.com/documentation/appkit/nsmenu) that can take different [NSMenuItem](https://developer.apple.com/documentation/appkit/nsmenuitem)s. Those again can either be a regular item or a [separator](https://developer.apple.com/documentation/appkit/nsmenuitem/1514838-separator).

With the help of separators, you could build different categories:
![image](https://user-images.githubusercontent.com/6698344/87702393-a4618680-c799-11ea-8914-825596ec40ee.png)

User agents could even choose to show the category title:
![image](https://user-images.githubusercontent.com/6698344/87702465-be9b6480-c799-11ea-96c5-24bbd1754691.png)

```swift
func applicationDockMenu(_ sender: NSApplication) -> NSMenu? {
    let dockMenu = NSMenu()
    dockMenu.autoenablesItems = false
    dockMenu.addItem(withTitle: "Timeline", action: #selector(action), keyEquivalent: "T")
    dockMenu.addItem(NSMenuItem.separator())
    // Uncomment for category title
    // dockMenu.addItem(withTitle: "Conversations", action: #selector(action), keyEquivalent: "C").isEnabled = false
    dockMenu.addItem(withTitle: "Mentions", action: #selector(action), keyEquivalent: "M")
    dockMenu.addItem(withTitle: "Direct Messages", action: #selector(action), keyEquivalent: "D")
    return dockMenu
}
```

Generally, I think this feature is super important and developers would like to have it, so I strongly support it!

However, I’m not sure if simply adding the `category` property is sufficient:
- How are the categories sorted? By the appearance of the first categorized item in the array? Or would the items have to appear consecutively? What if they don't?
- Can I have more than one category with the same name? (e.g., in macOS, you could have different “unnamed” categories)

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/manifest/issues/922#issuecomment-659563134

Received on Thursday, 16 July 2020 17:37:16 UTC