blenderskool / untab

🔍 A productivity tool to boost your browser workflow!
https://getuntab.now.sh
MIT License
345 stars 27 forks source link

Changed default sort to most recently used tab first #70

Closed rajeshmr82 closed 2 years ago

rajeshmr82 commented 2 years ago

Fixes #69

Change is to do sort based on lastAccessed field. So it works for Firefox, but Chrome doesn't have such a field it retains the current behavior

ghost commented 2 years ago

CodeSee Review Map:

Review these changes using an interactive CodeSee Map

Review in an interactive map

View more CodeSee Maps

Legend

CodeSee Map Legend

blenderskool commented 2 years ago

@rajeshmr82 Thanks for the changes! It works great on Firefox. Some changes that can improve the experience:

Edit: Also, it would be great if this can be implemented for Chrome as well. @rajeshmr82 would you be adding Chrome implementation on this PR?

rajeshmr82 commented 2 years ago

@blenderskool Thanks for the review! Good point about the 'current tab'. I will address that. As for Chrome, it does not expose a time stamp field like FireFox does. Only way we can get that info is to fetch tabs in their order displayed and then keep track of focus change from that point on. https://developer.chrome.com/docs/extensions/reference/tabs/ Let me research how this can be done for Chrome.

rajeshmr82 commented 2 years ago

@blenderskool I have updated code to remove current/active tab from the search result. Chrome does not provide a timestamp field (like lastAccessed in case of FireFox) so it is not possible to sort by last accessed. The next best thing is to keep track of active tabs. However, since the active tab is removed from search result it doesnt make sense to do that. If this sounds good, please accept the PR.

Couple of other things I noticed,

  1. In Chrome CTRL+SHIFT=SPACE opens a new UnTab tab every time, is that expected?
  2. In FireFox, when you do CTRL+SHIFT=SPACE on a tab, then move to another tab and then do the same it opens a new search window. The older one remains with (slightly) stale search results. i.e the search window is not universal for a browser window.
blenderskool commented 2 years ago

@rajeshmr82 Cool. I'll accept this PR but will keep the issue open for Chrome implementation in case others have any idea. Answers to your questions:

  1. It opens a new UnTab tab if it is unable to open it in the current page. #48
  2. Interesting, I'll check this behavior.