Skip to content

Commit 4bcace6

Browse files
committed
feat: add middle-click tab closing functionality
This commit enhances the tab management experience by allowing users to close tabs using the middle mouse button, provided the tab is not pinned. This addition improves usability and provides a more intuitive way to manage open tabs.
1 parent 4769659 commit 4bcace6

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

src/components/layout/MainContent.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,13 @@ function TabItem({ tab, isActive, onClose, onClick }: {
8787
: "text-muted-foreground hover:text-foreground/80 hover:bg-muted/40"
8888
)}
8989
onClick={onClick}
90+
onMouseDown={(e) => {
91+
// Middle-click to close tab (but not pinned tabs)
92+
if (e.button === 1 && !tab.isPinned) {
93+
e.preventDefault();
94+
onClose();
95+
}
96+
}}
9097
onKeyDown={(e) => {
9198
if (e.key === "Enter" || e.key === " ") {
9299
e.preventDefault();

0 commit comments

Comments
 (0)