locatorjs icon indicating copy to clipboard operation
locatorjs copied to clipboard

feat: add mouseModifiers parameter to setupLocatorUI

Open Strajk opened this issue 1 month ago • 1 comments

Summary

Adds a mouseModifiers parameter to the setupLocatorUI() function, allowing users to configure custom keyboard shortcuts when using Locator without the browser extension.

Changes

  • Added mouseModifiers?: string parameter to setup() function in packages/runtime/src/index.ts
  • Updated initRuntime() to accept and set the mouse modifiers via document.documentElement.dataset.locatorMouseModifiers
  • Maintains full backward compatibility (defaults to 'alt' if not specified)

Usage

import setupLocatorUI from '@locator/runtime'

if (process?.env?.NODE_ENV === 'development') {
  setupLocatorUI({ 
    adapter: 'jsx',
    mouseModifiers: 'meta+shift' // Cmd+Shift+Click instead of Option+Click
  })
}

Available Options

  • 'alt' - Option/Alt + Click (default)
  • 'meta' - Cmd/Windows + Click
  • 'shift' - Shift + Click
  • 'ctrl' - Ctrl + Click
  • 'meta+shift' - Cmd+Shift + Click
  • 'meta+alt' - Cmd+Option + Click
  • Any combination of alt, ctrl, meta, shift joined by +

Motivation

This feature parity with the browser extension allows users who manually inject the Locator UI to customize keyboard shortcuts according to their preferences, avoiding conflicts with other tools or personal workflow preferences.

Strajk avatar Nov 17 '25 17:11 Strajk