Decaying modifiers

I want a modifier that stays active for X seconds, then automatically turns itself off. Unlike with OneShot, I want every key pressed within those X seconds to have the modifier applied.

Is there any way to do this?

You could do that with a simple timer and an event handler hook. The trickiest part would be if you want to be able to have more than one active at a time. The other thing you’d want to store is the original keycode, in case a layer change happens before the timer runs out.