Skip to content

Instantly share code, notes, and snippets.

@xadn
Created March 13, 2026 18:08
Show Gist options
  • Select an option

  • Save xadn/0637fba7f36315a0e21d830ac254bc49 to your computer and use it in GitHub Desktop.

Select an option

Save xadn/0637fba7f36315a0e21d830ac254bc49 to your computer and use it in GitHub Desktop.
Claude Code command: Trash all unstarred gammas on the dashboard via browser automation
description allowed-tools
Trash all unstarred gammas on the current dashboard page using browser automation. Use when asked to "clean up gammas", "trash unstarred", "delete unstarred gammas", or "clean dashboard".
mcp__claude-in-chrome__tabs_context_mcp
mcp__claude-in-chrome__javascript_tool
mcp__claude-in-chrome__read_console_messages

Cleanup Unstarred Gammas

Switches to list view and trashes all unstarred gammas on the current dashboard page.

Prerequisites

  • Browser must be on a Gamma dashboard page (e.g., gamma.app/my-gammas or a folder)
  • Claude-in-Chrome extension must be active

Workflow

Step 1: Get browser context

mcp__claude-in-chrome__tabs_context_mcp

Verify the active tab is on a Gamma dashboard page. If not, ask the user to navigate there first.

Step 2: Switch to list view

Run this JS to ensure list view is active:

document.querySelector('[data-testid="view-toggle-list"]').click();

Wait ~500ms for the view to switch.

Step 3: Trash unstarred gammas

Run this JS to iterate through rows and trash each unstarred gamma:

(function() {
  function sleep(ms) {
    return new Promise(resolve => setTimeout(resolve, ms));
  }

  async function trashUnstarredGammas() {
    let trashed = 0;
    let errors = [];

    while (true) {
      const rows = Array.from(document.querySelectorAll('tr'));

      let targetRow = null;
      for (const row of rows) {
        const starBtn = row.querySelector('button[data-favorite-button="true"]');
        if (!starBtn) continue;
        const svgIcon = starBtn.querySelector('svg[data-prefix="far"]');
        if (svgIcon) {
          targetRow = row;
          break;
        }
      }

      if (!targetRow) break;

      const menuBtn = targetRow.querySelector('.chakra-menu__menu-button');
      if (!menuBtn) { errors.push('No menu button found'); break; }

      menuBtn.click();
      await sleep(600);

      const menuItems = document.querySelectorAll('[role="menuitem"]');
      let trashItem = null;
      for (const item of menuItems) {
        if (item.textContent.trim() === 'Send to trash') {
          trashItem = item;
          break;
        }
      }

      if (!trashItem) { errors.push('No trash option found'); break; }

      trashItem.click();
      trashed++;
      await sleep(800);
    }

    return { trashed, errors };
  }

  trashUnstarredGammas().then(result => console.log('CLEANUP_RESULT:' + JSON.stringify(result)));
})();

Step 4: Report results

After the script finishes, read console messages filtered by CLEANUP_RESULT to get the count:

mcp__claude-in-chrome__read_console_messages pattern="CLEANUP_RESULT"

Report how many gammas were trashed and any errors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment