This commit is contained in:
@@ -103,3 +103,15 @@ chrome.runtime.onMessage.addListener((message: { type: string; payload?: any },
|
||||
}
|
||||
return true;
|
||||
});
|
||||
|
||||
// Handle Command (Keyboard Shortcut)
|
||||
chrome.commands.onCommand.addListener((command) => {
|
||||
if (command === 'toggle-sidebar') {
|
||||
chrome.tabs.query({ active: true, currentWindow: true }, (tabs) => {
|
||||
const activeTab = tabs[0];
|
||||
if (activeTab?.id) {
|
||||
chrome.tabs.sendMessage(activeTab.id, { type: 'TOGGLE_SIDEBAR' });
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user