diff --git a/apps/desktop/src/components/main/body/index.tsx b/apps/desktop/src/components/main/body/index.tsx index b86c0fdbe5..a6c4ef7cd8 100644 --- a/apps/desktop/src/components/main/body/index.tsx +++ b/apps/desktop/src/components/main/body/index.tsx @@ -658,12 +658,13 @@ function useScrollActiveTabIntoView(tabs: Tab[]) { } function useTabsShortcuts() { - const { tabs, currentTab, close, select } = useTabs( + const { tabs, currentTab, close, select, unpin } = useTabs( useShallow((state) => ({ tabs: state.tabs, currentTab: state.currentTab, close: state.close, select: state.select, + unpin: state.unpin, })), ); const newNote = useNewNote({ behavior: "new" }); @@ -702,7 +703,11 @@ function useTabsShortcuts() { "mod+w", async () => { if (currentTab) { - close(currentTab); + if (currentTab.pinned) { + unpin(currentTab); + } else { + close(currentTab); + } } }, { @@ -710,7 +715,7 @@ function useTabsShortcuts() { enableOnFormTags: true, enableOnContentEditable: true, }, - [currentTab, close], + [currentTab, close, unpin], ); useHotkeys( diff --git a/apps/desktop/src/components/main/body/shared.tsx b/apps/desktop/src/components/main/body/shared.tsx index cc8793625d..c23a6ba417 100644 --- a/apps/desktop/src/components/main/body/shared.tsx +++ b/apps/desktop/src/components/main/body/shared.tsx @@ -131,7 +131,19 @@ export function TabItemBase({
) : pinned ? ( -