I have an office desk with a computer on it. After sitting in front of my computer for some period, if I get up and touch metal, I always get a spark.
In order to avoid surprises, I habitually touch metal whenever I get up now.
How can I prevent this build up of static electricity?
Happens to me all the time. I keep a spray-bottle of diluted fabric softener close by to spray down seats and coats that cause most of my shocks. I have heard that keeping dryer sheets in your pocket can help but I have had limited success with that. An added benefit is that my office space smells better after a couple of sprays from the bottle.
Hopefully this is just a combination of the dry winter air with various materials in your environment. You can get anti-static mats that are used for electronics work, perhaps they would make a decent mouse pad. They also have wrist straps, but those would be a pain to take on and off whenever you want to get up.
A more universal solution is to get a humidifier for the home. The humidity helps remove any build up. But don't turn it up too high since you don't want mildew or mold problems, and you don't want to create condensation issues in the windows.
Beyond that, review what materials you have separating you from a ground. I'm currently on carpeting, with a plastic chair mat, on a chair with plastic wheels and a fabric seat. In the winter time here, I'm a shock hazard. I may just try one of those anti-static mats.
Sound like something is not grounded like either the desk itself or a lamp, etc. that is on the desk. Make sure all items are plugged into outlets with a ground and if you are using an adapter (three prong to two prong adapter) make sure that the ground screw is in use.