Last key pressed expression

I’d like to have expression that would save last key being pressed into variable. Said variable could be then used with “A key is pressed (text expression)” which in turn would make user customizable controls a breeze.