Pass mouse position and active tool to extensions via optional CLI parameters

Description

This change introduces three new optional parameters that can be passed to extensions:

  • mouse-x: mouse coordinate on the X axis
  • mouse-y: mouse coordinate on the Y axis
  • tool: path of the currently active tool

These parameters are only passed if they are explicitly declared in the extension’s .inx file.


Motivation

While experimenting with extensions, I felt the need to be able do do something like "drop an object here" in the same way as the paste command pastes at the mouse coordinates.

This change enables extensions to better interact with the user context. In particular:

  • Extensions can create or position objects directly at the mouse location
  • Extensions can adapt their behavior depending on the active tool

This opens up new possibilities for more interactive and context-aware extensions.


Backward compatibility

The parameters are opt-in and only provided when declared in the .inx file.

This ensures that:

  • existing extensions are not affected
  • no changes are required for current extension implementations

Implementation notes

  • The change is minimal (small diff across a couple of files)
  • No impact on existing functionality unless the new parameters are used

Testing

Tested with a simple extension that:

  • reads mouse-x / mouse-y to place objects
  • reads tool to alter behavior

Caveats

this is my first attempt at c++ and contributing to an open source - have mercy

Edited by simone cesano

Merge request reports

Loading