diff --git a/extension/background.js b/extension/background.js index d2d57c91..21071044 100644 --- a/extension/background.js +++ b/extension/background.js @@ -172,6 +172,14 @@ chrome.runtime.onMessage.addListener((msg, sender, sendResponse) => { return true; } + // Open side panel from content script pill click + if (msg.type === 'openSidePanel') { + if (chrome.sidePanel?.open && sender.tab) { + chrome.sidePanel.open({ tabId: sender.tab.id }).catch(() => {}); + } + return; + } + // Sidebar → browse server command proxy if (msg.type === 'command') { executeCommand(msg.command, msg.args).then(result => sendResponse(result)); @@ -207,6 +215,19 @@ if (chrome.sidePanel && chrome.sidePanel.setPanelBehavior) { chrome.sidePanel.setPanelBehavior({ openPanelOnActionClick: true }).catch(() => {}); } +// Auto-open side panel on install/update — zero friction +chrome.runtime.onInstalled.addListener(async () => { + // Small delay to let the browser window fully initialize + setTimeout(async () => { + try { + const [win] = await chrome.windows.getAll({ windowTypes: ['normal'] }); + if (win && chrome.sidePanel?.open) { + await chrome.sidePanel.open({ windowId: win.id }); + } + } catch {} + }, 1000); +}); + // ─── Startup ──────────────────────────────────────────────────── loadPort().then(() => { diff --git a/extension/content.css b/extension/content.css index 408b2c1b..31d3f1eb 100644 --- a/extension/content.css +++ b/extension/content.css @@ -26,14 +26,14 @@ font-size: 11px; font-weight: 500; letter-spacing: 0.02em; - pointer-events: none; + pointer-events: auto; + cursor: pointer; transition: opacity 0.5s ease; box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4); } #gstack-status-pill:hover { opacity: 1 !important; - pointer-events: auto; } .gstack-pill-dot { diff --git a/extension/content.js b/extension/content.js index 2ceb75bf..30354527 100644 --- a/extension/content.js +++ b/extension/content.js @@ -19,6 +19,11 @@ function showStatusPill(connected, refs) { if (!statusPill) { statusPill = document.createElement('div'); statusPill.id = 'gstack-status-pill'; + statusPill.style.cursor = 'pointer'; + statusPill.addEventListener('click', () => { + // Ask background to open the side panel + chrome.runtime.sendMessage({ type: 'openSidePanel' }); + }); document.body.appendChild(statusPill); }