diff --git a/background.js b/background.js index 034fcdf..c27a622 100644 --- a/background.js +++ b/background.js @@ -2,14 +2,27 @@ // Handle keyboard shortcut chrome.commands.onCommand.addListener(async (command) => { + console.log('Command received:', command); if (command === 'activate-selector') { const [tab] = await chrome.tabs.query({ active: true, currentWindow: true }); - if (tab && tab.url && !tab.url.startsWith('chrome://') && !tab.url.startsWith('chrome-extension://')) { + if ( + tab && + tab.url && + !tab.url.startsWith('chrome://') && + !tab.url.startsWith('chrome-extension://') && + !tab.url.startsWith('edge://') && + !tab.url.startsWith('about:') && + tab.url !== 'chrome://newtab/' && + tab.url !== 'edge://newtab/' + ) { try { await chrome.tabs.sendMessage(tab.id, { action: 'activateFromShortcut' }); } catch (error) { - console.log('Could not activate selector on this page:', error); + console.log( + 'Could not activate selector on this page:', + error && error.message ? error.message : error + ); } } } @@ -20,4 +33,15 @@ chrome.runtime.onInstalled.addListener((details) => { if (details.reason === 'install') { console.log('Full Screenshot Selector installed'); } + // Log available commands and their current shortcuts to help debug + chrome.commands.getAll((commands) => { + console.log('Registered commands:', commands); + }); +}); + +// Also log commands on service worker startup (in case it wakes up later) +chrome.runtime.onStartup?.addListener(() => { + chrome.commands.getAll((commands) => { + console.log('Registered commands (onStartup):', commands); + }); }); \ No newline at end of file diff --git a/manifest.json b/manifest.json index 6530d95..96068a5 100644 --- a/manifest.json +++ b/manifest.json @@ -6,6 +6,7 @@ "permissions": [ "activeTab", + "tabs", "storage" ], @@ -35,8 +36,8 @@ "commands": { "activate-selector": { "suggested_key": { - "default": "Ctrl+Shift+S", - "mac": "Command+Shift+S" + "default": "Alt+Shift+S", + "mac": "Alt+Shift+S" }, "description": "Activate screenshot selector" } diff --git a/popup.html b/popup.html index 936be8f..8dea928 100644 --- a/popup.html +++ b/popup.html @@ -135,7 +135,7 @@
- 💡 Tip: Use Ctrl+Shift+S (or Cmd+Shift+S on Mac) to quickly activate + 💡 Tip: Use Alt+Shift+S (or Option+Shift+S on Mac) to quickly activate