zquestz / s

Open a web search in your terminal.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Use uri schemes for search in applications itselfs

KeizerDev opened this issue · comments

Like for spotify, you can use spotify:search:%s

As long as those schemes work cross platform, I have no problem using those. However it is probably more compatible to use the web urls.

Maybe a -n flag for "native url" and that activates another method on the interface for building the app based uri, and also provide the web version by default?

@zquestz I would do the opposite. I would rather use s if I can just search cross all than just limit it to the web.

So your saying default to the native uri? And have a flag to use the http version if you don't want the native url?

@zquestz yes, default to the uri because it would be a cross application search tool.

Maybe the provider can detect if the binary is there, and use the native url when present, and web url when not available?

Then the contract is nice and clean, and the searches always work as expected.

You could check the path variable but that would be harder on Windows. Anyway, when using, for example, Spotify you actually always use the client. If you're using the web client, you still have to be logged in first so than there won't be any benefit for s

Yeah I think we can just check to see if the binary is there. Check for "spotify" or "Spotify.app" and run from there.

@zquestz updated my comment 😃

Actually, you can't run from there. The uri scheme will still use the web browser. There is no way to talk otherwise to an application who is running.

Yeah if we see the binary we use the app uri, otherwise we load the web uri. It just is a failsafe.

Basically the provider can have logic to determine which URI to use, should be pretty simple for us to implement.

@zquestz Yeah I know, but how can you check on the binary? Especially on Windows this would be hard I think

I think it is doable. I might put in a helper for providers to use to check binary existence. Will add that tonight after work. =)

I do have a day job. hehe

For now we have found issues with compatibility between linux, mac and windows with regards to application native URIs. I think we should stick to web based for now to ensure compatibility.

Yeah, I was already seeing it. It seems the support was drop for newer versions and I'm still using an older version.