Skip to content

feat: add options to close multiple visible tabs in context menu - #6515

Merged
pajlada merged 17 commits into
Chatterino:masterfrom
otaviobia:feat/close-all-and-close-other-tabs
Nov 29, 2025
Merged

pajlada merged 17 commits into
Chatterino:masterfrom
otaviobia:feat/close-all-and-close-other-tabs

Conversation

@otaviobia

Copy link
Copy Markdown
Contributor

This is a draft PR for the "close all tabs" and "close other tabs" features, as commonly seen in web browsers.

I recently had to close all my Chatterino tabs and my first instinct was to look for it in the context menu, there wasn't an option so I closed them manually, having to tediously click yes on the confirmation prompts every time. I now know I could have spammed "ctrl + shift + W" to do it quicker, but I still think the dedicated buttons are more user friendly.

A few of my concerns:

  • Is there demand for it? Most users don't close all tabs that frequently.
  • How to avoid missclicks? I added confirmation prompts to avoid accidental mass closing.
  • Is my proposed solution conflicting with "split tabs"? I think the "ctrl + G" hotkey for reopening closed splits might display some strange behaviors when done after closing all or other tabs. I need to investigate it further.

Feedback is appreciated, thanks!

@otaviobia

Copy link
Copy Markdown
Contributor Author
example.mp4

@Nerixyz

Nerixyz commented Oct 3, 2025

Copy link
Copy Markdown
Contributor
  • Is there demand for it? Most users don't close all tabs that frequently.

Since this feature is pretty small, it isn't that much of an issue. Browsers have these options when closing tabs, so in my opinion, it's worth having this in Chatterino too.

  • How to avoid missclicks? I added confirmation prompts to avoid accidental mass closing.

Speaking of browsers: in Firefox, these options are in a submenu. To close multiple tabs using the mouse, you'd right-click the tab and select "Close Multiple Tabs > Close Other Tabs". However, in Chrome, they're in the main context menu.

  • I think the "ctrl + G" hotkey for reopening closed splits might display some strange behaviors when done after closing all or other tabs.

As long as it reopens some split closed by the operation, that should be fine. Which split is reopened should be considered implementation-defined until someone has a strong opinion about it and opens an issue.

@otaviobia

Copy link
Copy Markdown
Contributor Author

I added the options to close all tabs to the left or to the right. I also took the Firefox approach and grouped everything into a submenu (which I think removed the need for confirmation prompts). Lastly, I made it so this submenu is disabled if there's only one tab and the same thing for "close left" or "close right" depending if the tab is in a corner and which one.

Regarding tab visibility, right now it closes everything, even if it's hidden, I think it makes more sense to close only what's visible. My next steps will be related to this, but I wanted to ask first if that's also the behavior you would expect.

@pajlada pajlada left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

I think using Firefox's naming and order for the tab options would be good. If we only want it to apply to visible tabs (which I think is feasible), I don't mind making the naming of the options even more verbose:

  • "Close Visible Tabs to Left"
  • "Close Visible Tabs to Right"
  • "Close Other Visible Tabs"

I'm missing a confirmation option when closing tabs this way.


CTRL+G currently does nothing since it only operates on splits. If you close a tab, either by normal means or with your new functionality, CTRL+G does nothing since the tab it would try to re-open the split in doesn't exist.
I don't know the correct approach here, but I don't think it's up to you in this PR to solve this.

@otaviobia
otaviobia marked this pull request as ready for review November 18, 2025 00:59
@otaviobia
otaviobia requested a review from pajlada November 18, 2025 00:59
@otaviobia otaviobia changed the title feat: add "close all tabs" and "close other tabs" to context menu feat: add options to close multiple visible tabs in context menu Nov 18, 2025

@pajlada pajlada left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just these two nits, otherwise looks good

Comment thread src/widgets/helper/NotebookTab.cpp Outdated
Comment thread src/widgets/helper/NotebookTab.cpp Outdated
@pajlada

pajlada commented Nov 22, 2025

Copy link
Copy Markdown
Member

Alternatively, you could use Notebook's getSelectedIndex & solve all the visibility checks in the first loop

@otaviobia

Copy link
Copy Markdown
Contributor Author

It seems Notebook already had the functions I needed! I also changed visibleTabIndex to selectedTabIndex and I think everything should be fine now

Comment thread src/widgets/helper/NotebookTab.cpp Outdated
@pajlada
pajlada enabled auto-merge (squash) November 29, 2025 19:16
@pajlada
pajlada merged commit e060212 into Chatterino:master Nov 29, 2025
18 checks passed
@otaviobia
otaviobia deleted the feat/close-all-and-close-other-tabs branch November 29, 2025 19:44
babicekmarek pushed a commit to babicekmarek/streamally-chatterino that referenced this pull request Sep 14, 2026
…tterino#6515)

Reviewed-by: nerix <nero.9@hotmail.de>
Reviewed-by: pajlada <rasmus.karlsson@pajlada.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants