desktop icon indicating copy to clipboard operation
desktop copied to clipboard

feat: Add keybind for tabs-search

Open rstanuwijaya opened this issue 11 months ago • 7 comments

This PR attempts to add tabs search functionality as a single shortcut, trying to address #807. My main idea is using gURLBar.search('% ') to open the search bar for tab with Alt+Q.

edit: I have successfully built zen with this patch, but I still need help to address the following issues:

Todos:

  • [x] Update relevant translations, i.e. zen-search-shortcut-tabs = Search Tabs . #155
  • [x] Fix inconsistent behavior of tab key: pressing tab after opening the dialog will close it, unless some keyword have been typed. ~~Partially fixed by implementing a hacky workaround to simulate events (keypress arrow down + select text)~~ fixed
  • [x] Enable shift+alt+q for iterating selection in reverse direction.

Related issues:

  • [x] Preferably sort the tabs by order of recently opened. Edit: seems like the ordering is controlled by firefox's frecency algorithm. Modifying this may have unintended consequences on the accuracy of URL suggestions.
  • [x] Fix selecting switch to this tab for unloaded tab will open a new tab instead. Will receive the following error message: Tried to switch to non existant tab ~(FF Bug 1865757 in UrlbarInput.sys.mjs)~.

Workflow:

  • Pressing Alt+Q opens the UrlBar with the suggested tabs ordered by recently accessed.
  • To switch to the most recently opened tab (top suggestion), the user can directly press Alt+Q followed by Enter.
  • To search recent tab, the user can press Alt+Q, type in the keyword, and press Enter to switch to the top suggestion.
  • To select the next suggestion, the user can press Alt+Q again, or press Shift+Alt+Q to select the previous suggestion.

rstanuwijaya avatar May 13 '25 14:05 rstanuwijaya

I managed to hack around the firefox's database, and tracked the last time the tab is being selected.

Now it's possible to sort the tab suggestion by the last time tab being opened. It should work for unloaded tabs and tabs in another workspace as well.

https://github.com/user-attachments/assets/02c186f5-5957-45d9-bc29-a9e628825de6

rstanuwijaya avatar May 15 '25 17:05 rstanuwijaya

Awesome work! Really hope this can be incorporated into the core (either in Zen or in FF itself!)

vraravam avatar May 17 '25 07:05 vraravam

Ctrl+L and type % to search tabs

yokoffing avatar May 18 '25 14:05 yokoffing

Ctrl+L and type % to search tabs

This PR mainly adds keybind for that along with some improvements. https://github.com/zen-browser/desktop/discussions/807#discussioncomment-13177339

rstanuwijaya avatar May 18 '25 15:05 rstanuwijaya

Awesome work man! Need this merged asap. The default imprelemtation is driving me crazy.

fahidsarker avatar May 19 '25 04:05 fahidsarker

also @rstanuwijaya, is it possible make it configurable to any key-binding (if not already implemented)?

fahidsarker avatar May 19 '25 04:05 fahidsarker

also @rstanuwijaya, is it possible make it configurable to any key-binding (if not already implemented)?

already implemented, but the translation outside english is not yet complete

rstanuwijaya avatar May 19 '25 05:05 rstanuwijaya

@rstanuwijaya first of all thanks for the work. Would you know the reason with it is not integrated already? Looks like it is completed end to end

rjborba avatar Jun 17 '25 23:06 rjborba

Hello! Was curious about tab search and ended up finding this PR. Are there any issues with it right now?

TheLastAirbenderAng avatar Oct 29 '25 15:10 TheLastAirbenderAng

Hey, I will try to work on this again some time when I have more time :)

The approach I was doing was quite hacky though, so I'm not sure whether it will fit in the code base or not.

Maybe @mr-cheffy can help to briefly review and advice?

rstanuwijaya avatar Oct 29 '25 15:10 rstanuwijaya

any updates on merging this PR? Have been wanting this feature since the begining

fahidsarker avatar Jan 13 '26 07:01 fahidsarker