I just came upon this post on Reddit where another user was asking the same question:
"In general, corrections don't work with animals. This is because they tend to associate the corrections with YOU and get scared/angry with you rather than the situation you're trying to make them avoid.
I would recommend teaching an alternate behaviour.
Step 1. Management. We're going to be doing some heavy duty training ahead, so it's super important to eliminate all chances of the bird self-reinforcing for the thing we don't want to make it go faster. This means get some sort of heavy duty plastic or glass case to cover up the keyboard when it's not in use, so the bird can't get to it. When keyboard is in use, bird must be in a different room behind a door or in a cage.
Step 2. Set up the environment. Because to the bird's perspective the keyboard is the best toy that you have which YOU are always hogging to yourself (you criminal scum

), you need some sort of play stand with awesome amazing toys in the same room. Make sure that your bird has options to do something fun other than breaking keys.
Step 3. Time to teach the bird a new game. The idea of this game is that "whenever the keyboard is uncovered, the best place for me to be is on the play stand because GOODIES". If you have a clicker, this is the time to use it, and of course get your bird's fave treats ready (make sure they're as small as possible, we'll be using a lot). The very first version looks like this: place bird on stand, then in rapid succession uncover keyboard - instantly click, give the bird a treat AT THE STAND, quickly cover keyboard. Repeat when bird has finished eating and looks intrigued at this new game. Aim to do this as many times as possible a day, in 3-5 minute sessions. Don't go longer than that, you'll run into attention span and hunger satiation issues.
Step 4. Making the game harder. There are three aspects you can improve on here: DISTANCE, DISTRACTION, DURATION. Remember that it's of utmost importance to make the game as EASY as possible for the bird to succeed, so if you're working on one of the three D's, the other two have to be taken down to the easiest version. Only increase difficulty of one at a time.
DISTANCE - starting level has the training stand at a distance from the keyboard that you can just barely get to in 1 second with your treat. Progressively move the stand closer to the keyboard 10cm at a time. Ensure you are getting a >90% success ratio at one distance before moving it closer. If the bird attempts to get to keyboard more than 20% of the time, you made it too hard too fast, move the stand back a bit. Once you're confident in this and the other two Ds, you can start having the bird in other locations, such as on your shoulders.
DISTRACTION - starting level is lifting of cover only. Next step is to touch a key, click treat for staying on stand. Then touch two keys. Touch with whole hand. Press one key just enough to make a clicky sound. Then two keys together. Then two keys one after the other. Then repeat from scratch, but this time you sit down before touching the keyboard. You get the idea, progressively increase the amount of tempting sounds and body movement your bird is willing to sit through. The same 90% success ratio applies for these steps.
DURATION - starting level is to click treat immediately as the cover is lifted. Next, wait 0.5 seconds before clicking. Then 1. Then 2. Then 2.5, 3, 4, 5 etc. Once you have a couple of seconds on there, start watching your bird carefully and also click for anything the bird does (you can leave the keyboard uncovered this whole time, no need to replace the cover). Shifts his weight? Click. Stretches wing? Click. Beaks a toy? Click. Poops? Click. We're basically playing the "101 things to do with a box game", where the only thing we're NOT rewarding is trying to touch the keyboard. Once the bird is comfortably walking around the play stand and interacting with it, slowly reduce the rate at which you click - you were probably clicking for behaviors every 3 seconds or so, so now click every 4ish, then 5ish seconds, etc.
For the duration of all this training, if the bird tries to reach the keyboard, quickly cover it, and then calmly walk out of the room for 2 minutes. Don't say anything, no anger, no frustration! Your thought process should be "oh, I guess you don't want to play, we'll try again later." You basically want to act like nothing happened, this prevents you from inadvertently reinforcing.
Yes, it will be a long and involved process. Remember that your bird has already formed a habit of enjoying the keyboard - it will take just as long to extinguish the habit, and then the same amount of time again to form the new one you want. Expect it, accept it and celebrate each small milestone."
Anyone think this is worth trying?