johnste / finicky

A macOS app for customizing which browser to start
MIT License
3.74k stars 137 forks source link

How to detect the URL data from a Brave Browser PWA? #322

Open usizu opened 9 months ago

usizu commented 9 months ago

Any ideas, suggestions or other feedback I've installed a Progressive Web App through Brave Browser to my desktop (email client Proton Mail) and finicky doesn't detect it — even when adding the generalised URL logging from this page: https://github.com/johnste/finicky/wiki/Troubleshooting-&-Tips#i-want-to-see-all-incoming-parameters-to-the-url-handling-functions

The logging works for the same PWA installed from Safari, but not the one from Brave. Nothing shows up at all in the finicky console.

Is there any way to detect these URLs? Otherwise they always default to opening in Brave Browser, (they are ignored by finicky entirely, which has the default set to Safari).

usizu commented 9 months ago

(Given that it works with the PWA generated by Safari but not the one generated by Brave, my reason for using Brave's instead is just that when opened simultaneously, Brave's PWA launches faster)

usizu commented 9 months ago

Getting the bundleId with osascript -e 'id of app "ProtonMail"' (which is com.brave.Browser.app.jnpecgipniidlgicjocehkhajgdnjekh) and then doing

{
  // Open any link clicked in Proton Mail PWA
  match: ({ opener }) =>
    opener.bundleId === "com.brave.Browser.app.jnpecgipniidlgicjocehkhajgdnjekh",
  browser: "Safari"
},

also doesn't work

ascandroli commented 2 months ago

I found the solution https://github.com/johnste/finicky/issues/153#issuecomment-886952938 This is what I do for the Google Meet PWA using Brave too.

      {
            match: finicky.matchHostnames(["meet.google.com"]),
            browser: ({ urlString }) => ({
                name: "com.brave.Browser",
                profile: "Default",
                args: [
                    '--app-id=kjgfgldnnfoeklkmfkjfagphfepbbdan', // the app ID for the Google Meet application shortcut.
                    `--app-launch-url-for-shortcuts-menu-item=${urlString}`, // notice it is NOT passing 'url' as an array entry, but 'urlString' as string. Chrome Application Shortcuts need a normal string not url objects.

                ],
            }),
        },