oni icon indicating copy to clipboard operation
oni copied to clipboard

Register Oni as an editor for all file types, so it shows up in “Open with…” on macOS

Open mikl opened this issue 8 years ago • 8 comments

I know very little of macOS app development, so this is a suggestion for now…

A nice “Quality of Life” improvement for users on macOS would be for Oni to register itself as an editor for everything, so it always shows up in “Open with…” like I have a bunch of other apps doing in this screenshot:

screen shot 2018-03-26 at 17 13 02

I don’t know the mechanism for this, but it appears to be something any app can do (even if it makes very little sense, as is the case with “Day One” or “Notes.app” in this example), and it would be a huge help for Oni users on the Mac, since otherwise you have to select “Other” and find the app manually for every new file type.

mikl avatar Mar 26 '18 15:03 mikl

Hello and welcome to the Oni repository! Thanks for opening your first issue here. To help us out, please make sure to include as much detail as possible - including screenshots and logs, if possible.

oni-bot avatar Mar 26 '18 15:03 oni-bot

Seems reasonable! I think we have it setup for certain app types (as listed in the package.json) but not generally to appear in that "Open With" context menu.

I know the same functionality was added to the Windows binary so I expect we'd want feature parity when possible. (Only reason I didn't add it to Mac was since I'm unable to test it there and on Windows its done with registy keys which isn't applicable outside Windows).

CrossR avatar Mar 26 '18 15:03 CrossR

@mikl thanks for the opening this so we can track this 👍. We actually use electron-builder 's config settings to register oni as a default filetype on macOS but we have to manually specify the filetypes and I think at present that list is just

"fileAssociations": [
            {
                "ext": "js",
                "name": "javascript",
                "role": "Editor",
                "isPackage": true
            },
            {
                "ext": "json",
                "name": "JSON",
                "role": "Editor",
                "isPackage": true
            },
            {
                "ext": "jsx",
                "name": "JSX",
                "role": "Editor",
                "isPackage": true
            },
            {
                "ext": "py",
                "name": "Python",
                "role": "Editor",
                "isPackage": true
            },
            {
                "ext": "go",
                "name": "Go Lang",
                "role": "Editor",
                "isPackage": true
            },
            {
                "ext": "re",
                "name": "Reason",
                "role": "Editor",
                "isPackage": true
            },
            {
                "ext": "vim",
                "name": "VimL",
                "role": "Editor",
                "isPackage": true
            },
            {
                "ext": "ts",
                "name": "Typescript",
                "role": "Editor",
                "isPackage": true
            },
            {
                "ext": "tsx",
                "name": "Typescript",
                "role": "Editor",
                "isPackage": true
            },
            {
                "ext": "css",
                "name": "CSS",
                "role": "Editor",
                "isPackage": true
            },
            {
                "ext": "txt",
                "name": "Text",
                "role": "Editor",
                "isPackage": true
            },
            {
                "ext": "md",
                "name": "Markdown",
                "role": "Editor",
                "isPackage": true
            }
        ]

Very open to adding more it'd be great to have oni show up with more filetypes, which ones did you have in mind? (unfortunately I dont think theres a catch all)

akinsho avatar Mar 26 '18 15:03 akinsho

I was looking at what Atom does (it also being an Electron app), and they simply have a (much) longer list of file extensions, and they also have a wildcard in there: https://github.com/atom/atom/blob/master/resources/mac/atom-Info.plist#L1521

This part might also be significant

			<key>CFBundleTypeRole</key>
			<string>Editor</string>

mikl avatar Mar 26 '18 15:03 mikl

Ok, I’ll take a stab at extending the electron-builder settings to have more supported file extensions and also some of the special keys I’ve seen in other apps.

mikl avatar Mar 26 '18 18:03 mikl

That'd be great! Thanks for the help, @mikl 👍

bryphe avatar Mar 26 '18 18:03 bryphe

First PR is up.

mikl avatar Mar 26 '18 19:03 mikl

@mikl Did your PR address this issue?

badosu avatar May 21 '18 13:05 badosu