WebCord icon indicating copy to clipboard operation
WebCord copied to clipboard

Right-click to search

Open Hayao0819 opened this issue 7 months ago • 8 comments

Add "Search in Google" ContextThe official client Discord has a context menu for searching with Google.

I use this so often that I added it to WebCord as well.

Hayao0819 avatar May 13 '25 08:05 Hayao0819

Nice idea TBH! One thing I would work on, would be to use default search engine on browsers, if that's possible cross-platform. Why limit to just Google 😄? I might even go as far as to create a library for that sole purpose, of it required some platform-specific handling of things, ~~although I have high hopes for shell in Electron to be more than enough to handle it~~.

SpacingBat3 avatar May 14 '25 10:05 SpacingBat3

Since Discord is limited to Google, I thought that would be fine. I am not familiar with Eelctron, so it may be difficult to add a settings screen, etc.

~~By the way, it seems that even Microsoft and Apple are having difficulty implementing “use your favorite browser and engine”~~

Hayao0819 avatar May 14 '25 22:05 Hayao0819

Yeah, I looked into it, so far I got only the brief concept how to implement it properly. So far I've found a special kind of argument you might pass to some browsers in order to trigger a search with some keyword. The main concern is tho it requires gathering info on the full path of the browser. There's open package made by very famous library maker and Node FOSS developer, Sindre Sorhus that is available and has ability to get info on default browser, although I'm not quite sure on the details of it and how well it would behave in Electron ecosystem (mostly the concern is whenever it uses some kind of script or executable that might be needed to be extracted to work with my app packages as app.asar archive).

I can always work myself on such software, no sweat, I'm already building my own collection of libraries to use by myself since I'm little untrustworthy even with the popular and well-known projects, the colors.js case showed me well the consequences of impact of the untrustworthy developer messing with the systems via a package.

SpacingBat3 avatar May 14 '25 23:05 SpacingBat3

As of other alternatives, I guess… at worst I might finally get myself into implementing the input box handling in the settings for the custom string in the config. That would be usefull to further parse and use for defining your own search engine URL. But personally I'd still preffer to do it properly, so far I can only think of being able to pass GET params only (with the alternative approach than to start your browser as a detached process directly), privacy-oriented way tho (SearXNG folks do that mostly, myself included) is using POST request when passing a search query.

SpacingBat3 avatar May 14 '25 23:05 SpacingBat3

Since Discord is limited to Google, I thought that would be fine.

Ah, should say WebCord's not affiliated with Discord in any way. So far I'm more within the kind of community that hates it for every change that feels to ruin what I enjoyed Discord the most for.

Or at least I remember times when Discord UI was unique, wasn't material-designed stuff they thought switching to should be a standard for whatever weird reason, and they even designed it like to add a title bar to their web browser version… and the Nitro stuff /ads, weird promotions and non-chat related stuff… I kinda miss old Discord, those were simpler times XD.

Being slightly salty enough, I'm more into going into another direction than Discord. Especially I'm not in favour that they don't neccesarily care for folks who want to be more decisive what they don't need from their client to do.

SpacingBat3 avatar May 14 '25 23:05 SpacingBat3

I agree with you on Discord's recent bizarre and offensive changes.

Regarding search, how about using a simple string substitution (%q -> search string) to generate the URL and launch the browser?

Hayao0819 avatar May 15 '25 12:05 Hayao0819

how about using a simple string substitution

Exactly what I've fought for the alternative approach. Mainly I would like to launch browsers in a manner like:

[your best browser] "? [your search query]"

At least something like that, obviously it won't rely on shell's quote matching, we pass argv as an array element. Maybe I would go with Node's format() and %s instead %q.

SpacingBat3 avatar May 15 '25 13:05 SpacingBat3

And of course the ? method relies on support of the browsers for that kind of the syntax. Not sure how much that's widespread, but at least it would use your search engine, configured in your way. I think there also might be a "webdriver" stuff for launching browsers in more complex manner. Might use that as well if it is suitable and more standard approach.

SpacingBat3 avatar May 15 '25 13:05 SpacingBat3