ssborbis / ContextSearch-web-ext

Search engine manager for modern browsers
354 stars 37 forks source link

Immediate Search Engine opening with Quick Menu #194

Open Sagitee opened 5 years ago

Sagitee commented 5 years ago

Hi,

Now, when Quick Menu is opened and “Enter” is pressed the first Search Engine opens (according to the Left Button Search Action setting), looking up for the searched for terms, which is fine.

What about an added option for the same thing to happen, but automatically i.e. without the need to press the “Enter” key?

That will be very useful and time-work saving in cases when some search engine is used very frequently. Useful more properly when the Left Button Search Action is set to “Open in Side Bar”. In this way, when some other search engine is needed, no unnecessary tab-pages will be opened.

There could also be an added choice for the default search engine selection, like:

Thank you for the great CS extension.

ssborbis commented 5 years ago

What method are you using to open the quick menu?

I know some users adjust the menu offset so that the cursor is over the first engine tile and either quickly click once the menu opens or use an opening method that allows the search to execute on mouseup effectively making it a one-step way to search using the first engine.

Sagitee commented 5 years ago

I’m using the Mouse and Simple Click opening methods. Thanks for the suggested workaround, which could do well the job in those cases where the menu would contain not too many search engine icons. But, it won’t work in those cases where a big number of search engines are set up and the size of the Quick Menu grows enough. My QM (6 columns X 24 rows) covers all the height of the pages so as the offset setting (at least the vertical one) by force can’t be applied.

ssborbis commented 5 years ago

I see. You want to be able to click through words a web page and have search results show in the sidebar immediately. Pretty efficient setup if the click bypasses the menu and updates the sidebar. A bit of a niche method, but I'll see about putting something in.

Sagitee commented 5 years ago

That’s right!

But if by “bypassing the menu” you meant “without opening it”, this is not what I suggest.

I think the QM should properly work as it works now i.e. be opened and stay opened, with the searched terms in the QM text field, so as one can search further for them (unchanged or after an eventual manual changing of them in the text field) in additional search engines by clicking on the proper other search engine icons.

The suggested function would ideally add only the opening of the first in the list search engine automatically and concurrently, saving so for the need to press the “enter” key or to click the first in the list SE icon.

It would be great if CS had this feature too.

Of cource, the bypassing-not opening of the quick menu and the mere opening of the first in the list search engine (in the browser Side Bar) may be useful too, in certain cases and uses.

ssborbis commented 5 years ago

It's just a few lines of code. If you're sideloading, I can update the repo and give you the console commands to enable.

Sagitee commented 5 years ago

Ok, thank you, I can do it.

ssborbis commented 5 years ago

Ok, repo updated.

Set the option by opening CS options, ctrl+shift+K to open the console and enter

userOptions.quickMenuQuickSearch = true; saveOptions();

Now when you open the quick menu, the first search engine will execute immediately with your left-click search method.

To disable, just set to false with the same command.

ssborbis commented 5 years ago

I just updated the repo. If you grabbed a copy before this post, you need the more recent version for testing.

Sagitee commented 5 years ago

It works exactly as intended and needed. Thank you. I would suggest an additional AutoOpen Search Engine Tool-Icon for easily enabling-disabling it, like: AutoOpenTools AutoOpenIcon If it’s not much of work-coding for you, I would also suggest a Last Used option for the SE AutoOpening. If that is possible, the proposed additional tool-icon may do the switching between:

ssborbis commented 5 years ago

Wouldn't two options work? Disabled and Last Used? It could default to the first search engine until another is used.

ssborbis commented 5 years ago

You can try the lastest push. I've removed the preference option and replace it with a quick menu tool. You'll need to enable the tool in options->quick menu->tools

Once enabled, the tool will show in the tools menu in the qm. It is off by default. Clicking the icon will enable an instant search on the next qm launch. It will use the last search engine used, or the first in the quick menu if no searches have been performed in that tab. Each tab uses independent settings so you will need to turn on the tool each tab load / session.

Sagitee commented 5 years ago

Excellent work!!!

Last Used option, as it was implemented, is much more useful than that of the First Search Engine, which, in this way, becomes almost redundant.

Spliting hairs, for the description-tooltip of the this tool I would suggest something like: “Instant Search with the last-engine-used (the Left Button action setting is used)” “Perform a left-button search” may be kind of misleading making the user think that he/she has to press the left-button. “A search when the menu opens” is technically correct, but especially when the Quick Menu is Locked open, its programmatically necessary (?) closing and reopening when new terms are searched for, is practically making no sense for the user who may even not observe it. A term like “Instant Search” may be more appropriate and justified, as indeed no additional user’s action is required for the search.

ssborbis commented 5 years ago

I can tweak the name a bit. I'm not committed to anything.

I would guess the "instant search" tool has pretty limited user appeal and I've disabled it by default. Were you really just looking for a tool like the "last used" tool to have a recent engine in a huge list of engines readily available? Or do you need the ability to search when the menu opens without another click?

Sagitee commented 5 years ago

In the aspect I use CS, as described in the new issue #206 I have just opened (there I also explain why I consider "instant search" tool important), and according to the language of the pages I visit, I mainly use a proper translate-dictionary source e.g. Wiktionary (en), Larousse (fr), Treccani (it) etc. (where "instant search" is very useful), but as no resource is perfect and as for any term there may be different needs (more use examples, etymology, pronunciacion samples etc.), the lookup in additional resourses is often inevitable.

Sagitee commented 5 years ago

After having used the “Instant Search tool” for some days, I think that when a user has it enabled in the settings and then the tool is initially displayed inactivated on the next quick menu opening, any future on-QM activation-deactivation, should be kept permanent (until changed again by the user), i.e. like a drug-and-drop QM icon position change, that is kept so as all future openings of QM, in new and already opened tabs, show that change.

(I think the same method would also be better for the Lock menu open button, too.)

ssborbis commented 5 years ago

Currently, both the "lock" tool and "instant search" tool are enabled on a per-tab basis only, and their on / off setting does not persist to new tabs, tab reloads or new browser sessions. It was a design choice based on how I thought they would normally be used. It wouldn't take too much to add the option to persist. My only reservation being the additional UI required in the options page. I've been toying with the idea of adding / moving some of the more obscure settings to a separate Advanced tab in options, formatted similarly to the FF about:config page with a simple list of variables, values, and descriptions. When I get that set up, I'll see about adding a persist option for those tools.

Sagitee commented 5 years ago

That sounds a nice feature!

ssborbis commented 5 years ago

I made a bunch of changes to how the lock, last search, and repeat search are handled and added an advanced tab in options with some settings to persist the lock and repeat tools and pushed them to the repo. They could use a bit of testing though.

Sagitee commented 5 years ago

I’d missed this message.

Everything perfectly made and working!!!

I was puzzled a little when sometimes the Lasted used engine was reverting to none (although the “repeatsearch.persist” setting was activated) until I found out it was happening after some-whichever change in the CS Settings page.

About the OpeningOpacity setting which now regards only the Auto QM opening method: Wouldn’t be good if it could be activated for the Mouse and Simple Click too (for all these three methods, altogether or selectively).

ssborbis commented 5 years ago

I was puzzled a little when sometimes the Lasted used engine was reverting to none (although the “repeatsearch.persist” setting was activated) until I found out it was happening after some-whichever change in the CS Settings page.

Ah, I didn't add that variable to the save options yet, so it must be getting reverted. I'll fix that.

About the OpeningOpacity setting which now regards only the Auto QM opening method: Wouldn’t be good if it could be activated for the Mouse and Simple Click too (for all these three methods, altogether or selectively).

There's a bug in Firefox that's preventing it from working properly so I'm somewhat hiding it at the moment. Opening it up to all methods is simple, though.

dnknn commented 4 years ago

209_16061656

Hi @ssborbis ! I want to ask you about : Instant Search

I still don't understand its meaning,

I tried to enable it and disable it, the final result is exactly the same 👉Enable Last Used.

So i don't know what it means.

ssborbis commented 4 years ago

Hi @ssborbis ! I want to ask you about : Instant Search I still don't understand its meaning, I tried to enable it and disable it, the final result is exactly the same 👉Enable Last Used. So i don't know what it means.

It was a bit of a special-use case for @Sagitee. Basically, it performs a search using the last search engine when the quick menu is triggered to open. If you use a qm opening method like simple click, you could click words in a page without selecting them and have the search performed, bypassing the quick menu.

dnknn commented 4 years ago

@ssborbis Thanks, I still don't understand, but it doesn't matter.