Skip to content

Possible to define mouse hook *after* default action? #12

@ConstantinMaier

Description

@ConstantinMaier

Hey,

this is such a great plug-in - it's already enabled me to do so much. Thanks for creating this!

I’ve come across the following challenge:
When hooking into mouse clicks, it seems you can only define what happens before (or instead of) the default action. However, it doesn’t appear possible to define what should happen after the default action. Is there a way to achieve this? And if not, would it be possible to consider adding this as a feature in the future?

Here’s my use case:
In a script of mine, if the user moves a certain layer type to another index in the layer stack, other connected layers are supposed to automatically move as well.

Currently, I’m working around this by hooking the mouse event with Atarabi.mouse.hook(). Inside the hook, I save the current layer indices and then, before returning to the default action, I schedule a task with app.scheduleTask(). This task runs after the default action has finished (since scheduled tasks wait until the UI is idle), where I then check if the layer indices have changed.
While this works, it creates some unintended side effects, since a scheduled task is triggered on every click - including clicks in UI panels, etc. - so it’s not a very stable solution.

My question:
Is there an easier/more robust way to define behavior after the default mouse action, or perhaps a way to hook into mouseup events instead of mousedown?
If not, would it be possible to expose such functionality in a future update?

Hope this makes sense!
Again, thanks so much for your work on this plug-in - it's made a big difference for me.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions