From 60d28b9970e44900713a0e7741557f04925f2826 Mon Sep 17 00:00:00 2001 From: He4eT Date: Sun, 21 Jan 2024 21:56:29 +0100 Subject: [PATCH] pages/search: actions: pin or unpin tab --- pages/search/modules/actionboxHandlers.js | 11 +++++++++-- pages/search/modules/store.js | 1 + 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/pages/search/modules/actionboxHandlers.js b/pages/search/modules/actionboxHandlers.js index bb174a4..ff1c686 100644 --- a/pages/search/modules/actionboxHandlers.js +++ b/pages/search/modules/actionboxHandlers.js @@ -18,9 +18,8 @@ export const actionboxHandlers = (commandQuery, store, flush) => { /* */ 'c': duplicateTab, 's': discardTab, + 'p': pinOrUnpinTab, // 'e': Pop the tab into it's own window with minimal UI - // 'm': Mute or unmute the tab - // 'p': Pin or unpin the tab }[command] ?? noop(command))(store, label, flush) } @@ -78,3 +77,11 @@ function duplicateTab (store, label, flush) { store.actions.createBackgroundTab(tab.url) } } + +function pinOrUnpinTab (store, label, flush) { + const tab = getTabByLabel(store, label) + if (tab) { + flush() + store.actions.updateTab(tab.id, {pinned: !tab.pinned}) + } +} diff --git a/pages/search/modules/store.js b/pages/search/modules/store.js index a74d5bb..8b7d076 100644 --- a/pages/search/modules/store.js +++ b/pages/search/modules/store.js @@ -25,6 +25,7 @@ export const init = ({ 'favIconUrl', 'id', 'label', + 'pinned', 'title', 'url', ].reduce((acc, x) => (acc[x] = tab[x], acc), {})