ssborbis / ContextSearch-web-ext

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

Auto open Firefox sidebar #541

Closed wordpure closed 1 year ago

wordpure commented 2 years ago

Open in Sidebar prompts me to open ContextSearch's sidebar page to view search results when the Firefox sidebar is not expanded, or when the open sidebar page is not ContextSearch.

But it is troublesome to manually open the sidebar and switch to the page where ContextSearch is located. Can you improve Open in Sidebar so that it automatically opens ContextSearch in the sidebar when searching.

图片

ssborbis commented 2 years ago

Can't be done. There's nothing in the API that allows the menu to be opened. All I can do is remind the user to open the sidebar

ssborbis commented 2 years ago

Actually, I should say it can't be done from a search reliably due to the requirement that it must be triggered by a "user action", and the search actions are too far removed from the "click" action that would get the sidebar open. I'll take a fresh look at it, but I haven't had any luck in the past.

ssborbis commented 2 years ago

Ok, the deal is I CAN get the sidebar to open if the search is performed from the browser context menu. It won't be opened when searching from any other menu ( quick menu, toolbar menu, page tiles, etc ... ) due to the API's "user input" requirement, which seems to be limited to clicks on the context menu and maybe a few other events. If you're using the context menu, then you're in luck. Otherwise, I'm afraid you'll have to continue opening the sidebar manually.

wordpure commented 2 years ago

User actions - Mozilla | MDN mentions four user-triggered ways, the first and fourth should not work on normal web pages.

图片

But we may be able to use context menus, such as Open in Sidebar.

图片

Or assign a shortcut to the extension, such as Bitwarden?

图片

wordpure commented 2 years ago

Ok, the deal is I CAN get the sidebar to open if the search is performed from the browser context menu. It won't be opened when searching from any other menu ( quick menu, toolbar menu, page tiles, etc ... ) due to the API's "user input" requirement, which seems to be limited to clicks on the context menu and maybe a few other events. If you're using the context menu, then you're in luck. Otherwise, I'm afraid you'll have to continue opening the sidebar manually.

This is unfortunate news as I use the quick menu more often.

But I might be able to open the sidebar in the right-click menu instead.😁

ssborbis commented 2 years ago

Fix for the context menu is in the dev repo.

I'll think on whether a keyboard shortcut could be made useful. I can maybe see it working if combined with the repeat search / instant search tool ( repeat last search method + engine without a menu ). Might be sketchy on anything besides a text selection because it would rely on the element under the current mouse position. Could possibly work, though.

wordpure commented 1 year ago

I submitted a PR to allow users to customize a shortcut to activate the Firefox sidebar, I believe it can simplify some sidebar operations.