gpui-events

Manage mouse and keyboard event handling and GPUI action bindings.

Updated Mar 6, 2026
One-click install
npx skills add https://github.com/onehr/gpui-skills --skill gpui-events
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: gpui-events
Source: https://github.com/onehr/gpui-skills/tree/main/skills/gpui-events
Command: npx skills add https://github.com/onehr/gpui-skills --skill gpui-events

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill simplifies the process of managing user interactions within a GPUI application, including mouse clicks, keyboard inputs, and custom actions, ensuring a responsive and intuitive user experience.

Core Features & Use Cases

  • Event Handling: Captures and processes mouse events (clicks, moves, scrolls) and keyboard events.
  • Action System: Defines, binds, and handles custom actions, often triggered by keyboard shortcuts.
  • Focus Management: Manages UI element focus for targeted event and action dispatching.
  • Use Case: Implement a button that saves data when clicked, or a text input field that triggers a search when the user presses Enter.

Quick Start

Use the gpui-events skill to bind the 'cmd-s' key to a 'Save' action within the 'Editor' context.

Frequently Asked Questions about gpui-events

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I handle mouse and keyboard events in GPUI?

To handle mouse and keyboard events in GPUI, you capture and process inputs using `cx.listener()`. This ensures your interactive user interfaces respond deterministically to clicks, moves, scrolls, and key presses.

How do I bind a keyboard shortcut to a custom action in GPUI?

Binding a keyboard shortcut in GPUI requires defining actions with `actions!()` and mapping them using `KeyBinding`. This connects specific key presses, like `cmd-s`, to custom actions within your application context.

How does focus management work for GPUI event dispatching?

Focus management in GPUI uses `FocusHandle` to target UI elements for event and action dispatching. Managing focus ensures that keyboard inputs and custom actions are routed to the correct active component.

What is the best way to trigger a save action when clicking a button in GPUI?

Triggering a save action on button click in GPUI involves capturing mouse click events and executing a defined action. Use `cx.listener()` to process the click and invoke the save logic for a responsive user experience.

Do I need `cx.listener()` for deterministic event processing in GPUI?

Yes, `cx.listener()` is required for deterministic event processing in GPUI. It captures user interactions safely, ensuring mouse and keyboard inputs are processed correctly within the application's event loop.

Can I implement a text input field that triggers a search on Enter in GPUI?

Implementing a text input that triggers a search on Enter in GPUI uses keyboard event handling and the action system. You capture the Enter key press and dispatch a custom search action to process the query.