The task is to create an interlayer between the kernel and the user application (or some other option) to intercept keyboard events and further modify them. What can you tell? I do not know exactly where to start digging.
UPD: The task is to write a layer that will handle keyboard presses and, depending on its own internal state, send them to the active shell window.