I hope I can help you with this.
You've already established somethings that don't work, taking the computer away, nagging, and contracts. You've had talks with him about the importance of doing his school work and even if he agrees to a plan he won't stick with it. So, let's look at some other options.
For many people, playing video games is a stress
reliever. If we start with the idea that your son needs a certain amount of stress relief every day, you and he can look for ways to balance stress relief with responsibilities. After establishing what those stress relievers are and a reasonable amount of time he can spend doing them, then you have to have some way of enforcing the limits. My suggestion is, move the computer out of his room to a slightly more public area of the house. I understand he needs a certain amount of quiet to concentrate, so, hopefully, you can find a location that will work. Getting him out of his room will help you more easily see how he's spending his time.
Let him know that if he spends more time relaxing than agreed on, he won't be able to play his game the next day. You can enforce this by removing the keyboard. To get the keyboard back to do his school work, he has to be supervised enough hat you will know if he starts the game. Even if he refuses to work and spends the time watching tv, it won't be long before he will follow through because he wants the game time back. This will probably be a battle of wills for a while but you need to stick with it to get his attention.
Of course, you applying this structure isn't the ultimate goal. The goal is to get him to structure his own time. Let him know that the more responsible he is, the more he can make his own decisions. If he can have a full week of doing what he needs to do, he get 8 hours on a weekend day, to organize his own time. The better he does, the more time he gets. For example, after two weeks of you not having to intervene, he gets, 8 hrs on two weekend days. This can be adjusted to what the two of you agree on. The point being that, once you have an agreement, you'll be consistent no matter what he says or does. He can say he didn't agree to it, or he doesn't remember, but you'll still have the keyboard if he's not following the rules.
I hope this is helpful. Please let me know if there are things I can clarify or if you think there are parts that won't work.