tridactyl/tridactyl

tabdiscard --all

Opened this issue · 6 comments

  • Brief description of the problem:

Youtube, in particular, seem to cause Firefox to use infinite amount of CPU when you open a sufficient number of tabs. It would be helpful if tridactyl came with a canned option to discard (i.e. unload) all tabs to restore CPU usage. There are a couple of refinements that would be nice: a. don't discard current tab, b. don't discard the tab(s) that are currently playing audio (by default?), and c. provide an option to exclude certain some tabs from being discarded (by tab id, or regex of url?). The only site that I have issues with is reddit which uses doom scrolling yet doesn't update it's url so when it's reloaded you start at top instead of the position you were at.

henk (irc) mention the plugin
https://addons.mozilla.org/en-US/firefox/addon/auto-tab-discard/ which might be useful to review for inspiration. Unsaved content, for instance, might be prudent.

  • Steps to reproduce:
  1. youtube and open like 100 videos in tabs; Firefox will now use near 100% forever
  2. discard all tabs (like with the command discardall below) and CPU usage returns to normal.
  • Tridactyl version (:version): 1.23.0

  • Firefox version (Top right menu > Help > About Firefox): 115.4.0esr

  • URL of the website the bug happens on: reddit.com, youtube.com

  • Config (in a new tab, run :viewconfig --user, copy the url and paste it somewhere like gist.github.com): n/a

  • Contents of ~/.tridactylrc or ~/.config/tridactyl/tridactylrc (if they exist): The disccardall is what @bocine3dom shaved with me earlier.

colors dark

" The filter is almost the same as for vimperator, but it chooses new names for
" each hint after every non-hintchar character in the filterstring. This
" essentially "reflows" hints as the user filters them down.
set hintfiltermode vimperator-reflow
set putfrom selection
set searchurls.allmusic https://www.allmusic.com/search/artists/
setnull searchurls.amazonuk
setnull searchurls.googleuk
set searchurls.imdb https://www.imdb.com/find?q=
set searchurls.rfc https://www.rfc-editor.org/rfc/rfc
set yankto both
command discardall jsb browser.tabs.query({}).then(ts => browser.tabs.discard(ts.map(t=>t.id)))

I've found discardall the silver bullet for exactly the same situation since I discovered it in the tridactylrc file. Tridactyl packs such hidden gems even in the sample configs! I've even bound it to a key to reclaim RAM when I start feeling sluggishness on my PC. It also helped me avoid my Ubuntu not hibernating bc not having enough free swapfile!

@allanwind As it stands now judging by the title, I'd say the issue is solved and could be closed. However, did you made any progress worth sharing about the refinements you mention?

Hi @pataquets, I am a mere happy end-user so I was hoping someone more skilled with Tridactyl could add this.

Fair enough. In that case, if the issue can't be closed, I wonder if a more specific title and could be beneficial for it to be discovered by those who might be interested.

@bovine3dom asked me to file this ticket as a reminder to ship the feature. If you cannot rename the title, I am happy to do so if you think that would help.

I was just going to add a :tabdiscard [id] command with completions and an --all option. It would only really take a few minutes to add. I'll add the blocks-next-release label to remind me to do it :)

Some Bash-style brace expansion on tab ids would be pretty useful, I guess.