I need a better approach for "Start doing an action (i.e. dragging) while [key] is held down and stop when I release it"

basically the title

I find myself making many triggers that are of this “type” of action - my example was dragging so basically any action that is a “state” I want going on, while a key is held down.. my current solution is to create the entire thing within the initiating trigger so when I hold a key:
{start the action}
{wait for condition to happen}
{key is no longer down} *this is the clunky part - its creates bad delay which ruins most needs
{stop the action}

so how can I do it better? there has to be a neater approach you guys are doing to solve this type of actions
*
id much rather avoid splitting the action to two for every instance of such problem I have - I wanna believe it doesnt have to come to this

I'm not sure I understand correctly, do you have a concrete example?

ok I'll try to explain it with the current specific thing im trying to achieve:

Im trying to tie the “move window” and “hold cmd down” actions to right click drag (for context its to utilize the functionality of some tiling app)

so the order is:

I hold down right click ➜ start move window drag and hold cmd down (as long as right click is still being down ➜ when I release right click ➜ stop dragging window and release cmd

essentially it a continuous state that contains actions of the type that has an “initiate action” and a “stop action” - the former triggers on pressing down the manual key , and the latter actions trigger when I release said key.

the current solution I made where it is all nested in a single trigger used the “wait for condition” - for the release of said key , to execute the second part - but it has a bad delay which is not very usable…

I hope I explain it good enough, this “type” of triggers show up in many cases but fundamentally they are stemming from the same structure, so a general solution for the said goal above will be very beneficial…