Re: An "Open With..." submenu...
Re: An "Open With..." submenu...
- Subject: Re: An "Open With..." submenu...
- From: Ken Thomases <email@hidden>
- Date: Sat, 02 Apr 2011 18:31:47 -0500
On Apr 2, 2011, at 8:08 AM, Jason Harris wrote:
> Some users have asked for an "open with" menu to be added to MacHg. I have a menu delegate that captures when the contextual menu is firing and I can insert a "Open With..." menu at the right place and time in my 'menuNeedsUpdate' call. My question is does anyone have any prototype code already written that nicely constructs and manages the creation of this "Open With..." menu.
>
> I would of course imagine that the results would be generated from LSCopyApplicationURLsForURL [...]
>
> If this list is empty or "too" small then the application should fall back on kLSRolesViewer. Ordering preference should likely be given to the applications that are currently open. If its easy and possible then maybe ordering in the menu should be given by the last time an application was run? Then I can imagine if the user actually choose a particular application for opening the given file /document then maybe MacHg should order that application preferentially in the future higher in the list? It should definitely be the first choice in the list for the same file in the future. I can imagine other complications / subtleties around this topic.
In my opinion, you're over-designing this. To me, a menu that's "adaptive" like that ends up being, in practice, ever-shifting and unpredictable.
I would say, take the results from LSCopyApplicationURLsForURL, sort it lexically respecting localization. Pull out the default app indicated by LSGetApplicationForURL and put it on top with a separator below it. The Finder tags this item with a "(default)" label. If there are multiple entries with the same name, the Finder tags them with the version number. If the version numbers are the same, I recommend tagging them with the display path of the containing folder (either in parentheses or as a tooltip).
To let users specify a preference, I recommend following the Finder's lead again. If the user holds down Option/Alt, the Open With menu becomes Always Open With. If they pick something in that mode, the item opens and you should also remember the user's preference for that file. This would override the use of LSGetApplicationForURL that I described above in future Open With menus.
For specifying a preference for a type of file, rather than a specific file, the Finder relies on the Get Info window, which is kind of obscure and probably not applicable to MacHg. So, possibly extend the Always Open With technique by using an additional modifier key to change the menu to Always Open Type With, or something like that.
Regards,
Ken
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden