madprops / grasshopper

Advanced Tab Manager For Firefox
https://addons.mozilla.org/firefox/addon/grasshopper-urls/
GNU General Public License v3.0
55 stars 2 forks source link

Tab Root URLs #134

Closed N3C2L closed 1 month ago

N3C2L commented 1 month ago

Originally posted by @N3C2L in https://github.com/madprops/grasshopper/issues/120#issuecomment-2379457875

Because you mentioned the Browser Menu. I am often in the case, where I need to go back to the beginning of the browser history. I could use your cmd "Go Back" many times, which is located for example in the Browser Menu. But what if I want to go to the beginning of this browser history? My workaround for this is right clicking the left arrow on top of the ff browser and then going all the way down until the beginning url of this tab. But do you think this could be much faster when implemented in GH? Something like a new cmd "Go Root" where it takes me all the way back to the beginning url of the browser history of this tab. That would be awesome.

@madprops Regarding a concept that takes me back to the root url of a tab. (you can change the names of the following cmds as you like, they should just demonstrate my idea) Perhaps something similar to the "Custom URL" feature, but maybe called "Tab Root URLs". Somewhere in the settings under Tab Root URLs, the user could enter Tab Root URLs. This would create a list of Tab Root URLs similar to Custom URLs. Once a user has entered a Tab Root URL, they can right-click on a tab and select a Root URL for this tab from the list of Tab Root URLs (this might be possible with a new command like "Set Root URL", where when activated the list of the Tab Root URLs will spawn to choose from). After the user has set a Root URL for a tab, they would then need a new command like "Go Tab Root" which would allow them to return to their Tab Root URL. It would also be great if the user could select multiple tabs and execute "Go Tab Root", so that all the selected tabs could return to their respective tab root URLs.

madprops commented 1 month ago

How would gh know a url is associated with a tab root url?

madprops commented 1 month ago

How about using the tag system for this.

Associate tags with a tab root url?

That way the domain rules can be used too.

Or just add another property to domain rules.

Yeah I think a new property on domain rules would be the solution.

N3C2L commented 1 month ago

Ok, but for example edit title is also only for this tab. What if a user want's different Tab Root Urls for the same domain but on different tabs?

madprops commented 1 month ago

Ah right. Well I can add it per tab easily. I'll see how that goes.

N3C2L commented 1 month ago

Nice, thanks.

N3C2L commented 1 month ago

Short offtopic question here: Do you use other ff addons that can export the GH tabs? Background: I tried it with sidebery, but it seems this extension can not export and import my header tabs that I created in GH. So if I reimport the tabs that I have exported with sidebery, and then switching to the GH sidebar, the header tabs have no names in it, they are blank.

madprops commented 1 month ago

I don't use an addon for exporting tabs.

I think the header tabs are special pages made by the GH.

I'll check sidebery to see what it is exporting.

Can you tell me how to do that in Sidebery?

I think it's Create Snapshot.

N3C2L commented 1 month ago

Yeah Snapshots, saves tabs and can export to file formats.

madprops commented 1 month ago

Seems to restore fine, with the headers, when I click Open Window with the snapshot

N3C2L commented 1 month ago

Also if you previously changed the headers name with the edit title cmds?

madprops commented 1 month ago

No because the titles are saved on the tab data which gets wiped on snapshot load I guess

N3C2L commented 1 month ago

Yeah, too bad.

madprops commented 1 month ago

Well I can try saving the title to localStorage

The headers have that textarea thing I can use.

N3C2L commented 1 month ago

This would be great, thanks.

madprops commented 1 month ago

Nah nvm, the localStorage is shared among all headers, so they'll all have the same title.

N3C2L commented 1 month ago

Ok I did another test. It seems it's also the case when renaming non-header tabs. But if I rename a normal tab inside the sidebery interface, then take a snapshot, open this snapshot in a new window, the edited name of this tab is restored. Maybe you can look what they are doing different when renaming tabs.

madprops commented 1 month ago

They're using customTitle while I use custom_title.

What I'm gonna do is save both of those so they're compatible.

N3C2L commented 1 month ago

Much appreciated!

madprops commented 1 month ago

Sorry it seems the data is sandboxed per extension, for security most likely.

I had to debug a local instance of sidebery. I was using the same tab id etc, and I couldn't read sidebery's data, and thus it can't read gh's

N3C2L commented 1 month ago

Hm, ok. Maybe do you want to implement GH own tabs export feature in near future? 😁 For example save to json.

madprops commented 1 month ago

That's what I was thinking. Exporting is easy. Importing is a bit more tricky. I'll see what I can do.

N3C2L commented 1 month ago

Great!

madprops commented 1 month ago

Ok it's working beautifully. I won't make a snapshots manager or anything though, only copy/paste json.

It's aware of data so titles, colors, tags, notes, etc remain.

And the order is preserved. And pins.

Big update. Lots of stuff today.

Also signals have an option to include the tabs snapshot in the payload. So for instance you can send a signal to your personal web server to backup the snapshots periodically.

madprops commented 1 month ago

v3318

Added Root property to tabs. They can be set per tab with the Edit Root cmd, but also it's now a rule. You can set roots on domain rules.

The old Filter Root command is now called Filter Nodes. This command shows child nodes of a tab (opened through that tab). This is also added to the Item Menu.

Some code refactoring due to additions.

Close button now has a menu on right click. Configurable and it's a command.

Export Tabs and Import Tabs commands. This produce a json as described. Importing resolves the old nodes, the opener tab, so that isn't lost either.

N3C2L commented 1 month ago

Very good additions! Thanks a bunch! I am looking forward to give some feedback to this update tomorrow.

N3C2L commented 1 month ago

Thanks again! And here is my feedback:

  1. I have tested the import/export tabs function. So far so good, and it's also good that it opens in a new window during import so that the current tabs are not overwritten. The order of the imported tabs is correct for me, and all edits of the tabs have been restored (title, tags etc.), very good. The only problem I find is that the tabs are loaded when importing. However, the tabs should be unloaded after importing (as in sidebery). This prevents CPU spikes when importing hundreds of tabs.
  2. Thank you also for the Root commands, they all work wonderfully for me. It's also nice that the root commands on tabs and the domain rules with set root URLs don't interfere with each other, both working on different tabs. An improvement could be a separate root icon and domain rules icon. For example, if you click on the root icon on the tab, you go directly back to the root URL, of course also possible when clicking on the domain rule icon, if you have provided a root URL there. Both would be good for a better tab overview to immediately see which tabs have root urls / domain rules applied. If it's not too much trouble, I would also be glad if the icons (+ also the color icons) could be displayed on the far right of the tab. The advantage would be that I could differentiate more quickly between favicons of the website and icons that come from GH, and also because then there are not so many icons next to each other on the left side. I think the first 9 icons under > settings > icons wouldn't need an option for settings right/left on a tab that urgent, but I think the icons below 9 and some new icons I described above would need one. Elsewhere all icons are crowded on the left side on the tab if many are activated. Discovered a small typo here: Settings > General > "Icon Efect"
  3. Regarding the cool nodes feature: I do think it could be also enhanced with the node icon displayed on the parent node tab, only visible if some tabs have been opened from this tab. But a problem was, if I opened some child nodes from the parent node tab with the native ff "open tab in background" feature (the new opened tab won't be focused with this feature, so this newly background tab is an unread tab then) from firefox (executed with the shortcut "ctrl+shift+middle mouse button" on a link on a website), the child nodes couldn't be filtered afterwards.
madprops commented 1 month ago

I did try to unload the imports before but couldn't, I did it this time though, fixed.

There is now a Root Icon. Clicking this goes to root.

There is a Left/Right selector for all icons now.

About 3, seems like a limitation imposed by firefox, and thus not reporting the opener, nothing I can do.

Also when a tab has nodes, and you right click it to show the Item Menu, there is a Nodes item at the very top. There is also a Root item at the top if the item has a root.

Gonna add a Nodes icon to show it has nodes.

Middle Click nodes icon to close all nodes.

N3C2L commented 1 month ago

I did try to unload the imports before but couldn't, I did it this time though, fixed.

There is now a Root Icon. Clicking this goes to root.

There is a Left/Right selector for all icons now.

Thanks!

About 3, seems like a limitation imposed by firefox, and thus not reporting the opener, nothing I can do.

It's ok, I can filter unread tabs if needed.

Also when a tab has nodes, and you right click it to show the Item Menu, there is a Nodes item at the very top. There is also a Root item at the top if the item has a root.

Good to know!

Gonna add a Nodes icon to show it has nodes.

Middle Click nodes icon to close all nodes.

Thanks again, and middle click on nodes to close them, good one.

madprops commented 1 month ago

More work on icons. Added option for color icons as well.

Changing defaults to right for notes icon and color icons.

Upload soon.

N3C2L commented 1 month ago

If it's ok I would continue my feedback for nodes / icons / roots:

  1. There is a problem with child nodes: When you move child nodes, it becomes confusing which parent they belong to, and additionally, the click on the "has parent" icon no longer works. It therefore no longer focuses on the parent tab. Perhaps a solution would be that when you move this child tab, the parent icon is deleted from this child node tab? This way, you could also move these child node tabs to other zones.
  2. I'd also love the possiblity to give the parent node / child node tabs some css styling: But since the parent node tabs and the child node tabs doesn't have seperate classes / css selectors , I don't know what you do you think makes more sense, own classes / selectors or is it too messy and you would like to give options in the GH settings for that? For example I'd style my parent tabs with this (to seperate them from other tabs better visually): margin-top: 15px; And for the child tabs I would assign these (as an indent to seperate them visually better from the parent tabs): border-left: 1rem solid; border-left-color: orange;
  3. It would be great if there could be an option for the custom icons (edit icon cmd) to be displayed on the right side of the tab.
  4. I'd like to create a combo with this 2 cmds: Go to root > unload Problem: The website won't go to the root, because it's unloading the tab first. Solution would be new delay cmds only visible in the combos settings menu. For example I would create this combo with 1s delay (between Go to root and unload) to be sure that every website, even slower websites, would return to the root, before unloading. In my tests it takes 750ms to return to the github notifications site plus loading the github favicon also which is important. Of course I could set the delay for all combos to 1 second, but this a huge amount of delay only because some combos need a higher delay like my one above. Because usually 100ms is fine between most cmds I think, but on some cases like website loading a higher delay cmd would be great. There don't need to be many delay cmds introduced because we could stack some of them in one combo if needed.
madprops commented 1 month ago

I don't understand #1, moving a tab up or down doesn't change nodes.

N3C2L commented 1 month ago

Hm did you try with the mouse with drag and drop?

madprops commented 1 month ago

You mean between windows? Dragging tabs up or down doesn't change the tab tree

madprops commented 1 month ago

I'll do #3 and check why #4 is not working

N3C2L commented 1 month ago

Edit: Ok I was wrong, sorry, #1 is working, all good.

madprops commented 1 month ago

Not sure how to tackle #4 -- should I make delay per combo, or should I add a Sleep 1 Second command hmm

N3C2L commented 1 month ago

Commands would be more fine grained, or? User is flexible with different ms or s of delay per combo.

madprops commented 1 month ago

I could just add a special sleep command you add to combos between items. like 500ms or 1 second and you just add them in between commands

N3C2L commented 1 month ago

Yes, that would be great.

madprops commented 1 month ago

About #2, remember that tabs can be parents and nodes at the same time. Also not sure how easy it would be to update the styling

madprops commented 1 month ago

There's gonna be a 500ms cmd and a 1000ms cmd

combos234

madprops commented 1 month ago

New version up.

N3C2L commented 1 month ago

Thanks! Ok, I didn't know that childs can also be parents, that would of course confuse the styling then. I remembered that other extensions like sidebery oder tree style tab provided different classes / css selectors for the parent and child tab for css styling.

N3C2L commented 1 month ago

Just realized that when I closed and reopened a child tab, I can't go back to the parent tab (no "has parent" icon anymore on the tab)

This problem is more visible when the icons for parent tabs and node tabs are activated: When I move a node child tab to another zone (without the parent tab), it would be helpful to delete the status of being a child tab or parent tab. Because this is then not relevant anymore in the other zone because the parent tab isn't there anymore. Maybe new commands could delete nodes child tab / parent tab status when needed? Because elsewhere the icons on the child tab would take me to a parent tab in the other zone.

madprops commented 1 month ago

It's not the same concept as tree style tabs. Parent only means that it was the tab that opened the node. For instance if you are in a forum and you open 5 threads through that tab, that is the parent of 5 nodes.

The internal firefox word is "opener".

Re-opening a tab deletes the opener property.

N3C2L commented 1 month ago

I see. Thanks for the clarification.

N3C2L commented 1 month ago

I am also a guy who doesn't need tab groups at all, because I love it flat, and don't want that tabs to indent all the time. But I do think the opener concept could be visually more appealing if parent tabs and nodes could be differently tuned with css. Do you think it could be possible to provide an option, that a node tab can't be a also a parent tab? And if a user want that a node tab to be a parent tab, he needs to close and reopen this tab for example and add some nodes to it. The advantage would be that users could style this parent & node tabs differently like I described above with some css things.

madprops commented 1 month ago

I'd rather not do that sorry. I don't want to over-complicate simple links between tabs.

madprops commented 1 month ago

Well tabs have root urls now. So I'm closing this.

madprops commented 1 month ago

I'm gonna make it so the root icon only appears when going back a root is possible, that is, it's not already at the root.

Also going to give it a default icon since it's more useful now.

Gonna add a setting in Icons to make it auto or not. Checkbox.