mattorchard / grouper

1 stars 1 forks source link

Auto-Sort New/Updated Tabs #2

Open WHiZSTA opened 10 months ago

WHiZSTA commented 10 months ago

While the group/ungroup functionality works great, when you have a ton of tabs, it obviously takes a long time for it to process/sort them all into groups. It basically means i only sort into groups on rare occasion, and then have a bunch of new tabs that are unsorted unless i want to process everything all over again.

I propose changing the "auto-run" functionality, so that once all of your existing tabs have been grouped with the group button, the extension would auto-execute on any new tab, or change of address on an existing one(aka you follow a link that takes you elsewhere/would change the grouping). It wouldn't execute a full group sort of all your tabs like the "group" button does, but it would only process that particular tab to whatever group it newly belongs in. This would save greatly on processing power and will always keep all of your tabs old or new properly sorted into the right groups.

Thanks for your consideration

mattorchard commented 10 months ago

Howdy @WHiZSTA, thank you for the suggestion! As for an "auto-run" or "auto-apply" feature. I'm not opposed to adding it, though it could be jarring to have the current tab slide around as you navigate different pages. Especially if combined with the "Cross windows" option that may move the active tab into another window during a navigation.

I'll experiment with it a bit to see what it feels like and get back to you.

mattorchard commented 10 months ago

As for the slowness, that isn't something I've encountered personally. Would you mind creating another ticket for addressing that, with details on:

WHiZSTA commented 10 months ago

As for the slowness, that isn't something I've encountered personally. Would you mind creating another ticket for addressing that, with details on:

  • What settings you use
  • How many rules you have
  • How many tabs are open
  • How many windows are open
  • How long it takes to run Maybe even a short recording showing the issue? (I'm partial to making short videos with Vippet)

oh the slowness of the sorting is 100% a me issue, not a you issue.

my experience is there are 2 of camps of people. half of people browse with a small number of tabs and close the browser clearing the tabs, and the other half keeps a ton of tabs open until they can get to them and reload them between browsing sessions. i'm one of the later half, but i realize even then i'm more on the extreme end of the "a ton of tabs" side of things compared to most who just have a few hundred.

make sure you are sitting for this one. i'm currently sitting at 1,676 tabs open. luckily chrome has adapted over the recent years to the two types of people and they added stuff to not bog the browser down by discarding them from memory until i click back to them.

but obviously that's why performance matters to me of not doing a full regroup, if it's not needed, as going through all of those comparing to all my rules etc takes a while, vs just updating those that are new/changed. but it also shows why organizing them into groups is so important otherwise i'd be in a bigger bind.

mattorchard commented 10 months ago

After some messing around, Brave does seem a little slower than Chrome for grouping, even with only 100 tabs it was taking over 500ms, even when only 1 tab was out of place.

So I have not investigated an auto-apply option yet, but I did merge a change that drastically sped up performance for re-grouping, particularly in Brave.

I will work to get the newer faster version sent to the Web Store for approval shortly, and investigate the auto-apply next.

mattorchard commented 9 months ago

I have a draft branch up with auto-applying groupings (for pre-existing explicit-groups, not auto-groups). It needs some experimentation to see how it behaves with

I'd also be interested to see about the performance of it, though replicating the scale of your use case may be somewhat difficult 😆

WHiZSTA commented 9 months ago

@mattorchard thank you so much for work on it.

Pardon my ignorance, but how can i get this into a state that i can load in the browser to help experiment with/test it?

mattorchard commented 9 months ago

Howdy @WHiZSTA I'll do some experimentation on my end, so no pressure! But if you'd like to get setup and try it out the process shouldn't be too bad:

  1. Clone the repo
  2. Run yarn install
  3. Start the dev server with yarn dev
  4. Load up the dist folder as an unpacked extension by following these 3 steps (I assume the process is similar for brave)
  5. Tada

It is sometimes helpful to disable the version of Grouper from the webstore so you only have one at a time,

WHiZSTA commented 9 months ago

thanks, i had tried it from 4 onwards the other day with no luck, needed the first part too it seems. =) i'll try to get it up today to help out where i can.

WHiZSTA commented 7 months ago

Any plans to merge this into the published extension?

mattorchard commented 7 months ago

No plans to merge it yet. Though I'm also not completely ruling it out just yet. The experimental branch would still need some fixes and updates to work properly in all cases.

Also, after I messed around having it enabled for a few weeks it kind of nice in some cases, but really frustrating in others. I think I'd need to figure out a happy medium with how cross-window stuff works, and a smart way of preserving the active tab in all cases, as well as the proper collapsed state.

WHiZSTA commented 7 months ago

Would you be able to post a compiled copy of it for me perchance? i had a lot of issues trying to test it b4, because the language wasn't straight javascript. from what i read the language you use compiles into straight js, but it isn't in that format yet. i wasn't able to find an online compiler/packager to do it back when i tried.

mattorchard commented 7 months ago

Oh I will make and link a zip with the compiled experimental branch for you this weekend (for free 😁).

But also, if you'd like to get setup yourself: there's a couple steps that are necessary before the ones I listed above:

  1. Download and install node.js (which should automatically install npm)
  2. Install yarn by running npm install --global yarn

Then the steps above should install the bundler (parcel) and the typescript compiler, and start running the process which auto-builds the extension whenever one of the source files changes.

WHiZSTA commented 7 months ago

Yeah, Sorry for the hassle =(. I had tried to find a way to compile it to a .CRX online without having to install all developer stuff, as i'm on windows not linux and setting it up and maintaining it for one extension seemed excessive. I'll buy ya a coffee for your trouble =)

mattorchard commented 7 months ago

Howdy @WHiZSTA, Here's a zip with the experimental changes in it: dist-v0112.zip

To install:

  1. Go to chrome://extensions/ and disable the version of Grouper from the web-store (v0.1.1)
  2. Download the zip using the link above
  3. Unzip the zip
  4. Go back to chrome://extensions/: i. Enable Developer mode (in the top right) ii. Choose Load unpacked (in the top left) iii. Select the unzipped folder
  5. Tada 🎉

From there it should be good to go, though you'll have to recreate your rules, as Chrome will see it as a brand new extension.

So long as v0.1.1.2 is the version that's enabled the auto-apply should be always on. It's still just an experimentm so if something is buggy or a bit odd that's to be expected.

If you ever wanna toggle back to the old one you can just use the toggle-switches in the chrome://extensions/ (the experimental one will have an orange badge on the icon).

Good luck!

WHiZSTA commented 7 months ago

Thank you so much! I got it up and working, and my rules all transferred over. It's working really good on my first tests.

So far the only new issue i've experienced(might be old but wasn't as often without auto sort) is it isn't ignoring the pinned tabs. Gmail keeps getting removed from pinned and sorted. I'll work around that for now by giving it it's own group.

Also it seems like it might get stuck in a bit of an extended loop(seems longer than it should/how long it used to be but it might just be my perception) if you click on ungroup or group

I'm not sure what if any other code changes you might have in this other than the auto sort. The group order is still messing up, but i havent had the empty named groups incase either of those might be in this.

Also do you know if there is any way to take the new tab it sorted(if it is the active tab) and auto scroll the tab bar so that tab is visible in the list? I know it's possible for 3rd party tab bars to scroll to the active tab, but i'm not sure if chrome gives extension's access to scroll it's own bar.

WHiZSTA commented 2 months ago

Hello, It's been a number of months using this modified version and i thought i'd follow up with my thoughts/experience. I love it, and actually think it would be safe to integrate as an option with your main extension if you so desired.

There is a bug where, regardless of if cross-window is checked or not, any new window created will auto have its' tabs moved to the old window closing that new window, so you are forced to only use one window. I'm assuming it's just a bug, the tab update code doesn't check.

Regarding one of the things you were trying to decide on, about how to handle cross window stuff in a finished version, personal pref, but i'd suggest not having it do cross window in this mode, someone can always combine the windows or move tabs they want over to the other.

I'm hoping you consider merging this into your main extension as it really makes things a lot easier/more organized and i'm sure more people than just me would find it useful.

Thanks again for all your hard work on it! Dave