diff --git a/packages/bruno-app/src/providers/Hotkeys/index.js b/packages/bruno-app/src/providers/Hotkeys/index.js index 8b0503b1c..53a0fc263 100644 --- a/packages/bruno-app/src/providers/Hotkeys/index.js +++ b/packages/bruno-app/src/providers/Hotkeys/index.js @@ -154,6 +154,31 @@ export const HotkeysProvider = (props) => { }; }, [activeTabUid]); + // close all tabs + useEffect(() => { + Mousetrap.bind(['command+shift+w', 'ctrl+shift+w'], (e) => { + const activeTab = find(tabs, (t) => t.uid === activeTabUid); + if (activeTab) { + const collection = findCollectionByUid(collections, activeTab.collectionUid); + + if (collection) { + const tabUids = tabs.filter((tab) => tab.collectionUid === collection.uid).map((tab) => tab.uid); + dispatch( + closeTabs({ + tabUids: tabUids + }) + ); + } + } + + return false; // this stops the event bubbling + }); + + return () => { + Mousetrap.unbind(['command+shift+w', 'ctrl+shift+w']); + }; + }, [activeTabUid, tabs, collections, dispatch]); + return ( {showSaveRequestModal && (