I think the best way to do this is to teach him it's not good to stay on your keyboard.
With a child you would say "You can't do this" and he would understand. But animals doesn't understand
portuguese english (I'm Brazilian XD), so that tatic of sprinkling some water on it is good.
Everytime he manages to do this, sprinkle water and take him out. Your cat will get upset and after some tries he will link the bad idea of "water in my face" with "keyboard", and that going on it is a bad idea; they won't try to do this anymore.
You can do this also with direct flashing light (2 flashes at most, please) and some simple words, like "No you can't". The words will get linked too, and after sometime you can try only to say "No you can't", and they will obbey.
I don't think that giving food or toys will help. They don't want food or toys, they want to sleep on that confortable thing that your keyboard is. And you need to tell them they shouldn't.
Of course that if you aren't giving them enough attention or food, they want food and attention, so you should be right it's not the problem, first of all.
After that... good luck =D