I have two cats myself, and luckily, I don't have any problems with them laying on the keyboard. But, when I asked a Veterinarian one time about how to proactively keep a cat out of somewhere you don't want a cat, and he gave me the best advice.. He said "Whatever the deterrant, it needs to be god that acts it." Meaning, if you want your cat to stay off the kitchen counter, the mere act of you spraying your cat is not enough. Because then all the cat learns is not to be on the Kitchen counter when you are around with a spray bottle.
-Brad