Possible to attach event handlers to widgets in theme/plugin?

api.attachWidgetAction is the way to go. You can read search the codebase and you’ll be gtg.

Examples here