I just moved into a new apartment. It has polyester carpet everywhere but the bathroom and kitchen. I am constantly getting shocked when I touch a light switch.
Despite being enclosed in an entirely wooden desk roll-out cart, more than once, while plugging in a flight stick or earphones, the USB plug sparks, the speakers crackle, and the PC shuts off. I need to do something before the magic blue smoke comes out.
Does the PC glitch or shut off if you discharge yourself to a metal part of the chassis instead of the port?
What are good solutions for this? A ground cable of some kind?
A ground cable would help if you make sure you touch that first before trying to plug in the peripherals.
An anti-static mat?
Do you mean a floor mat, or one of the benchtop anti-static mats typically used at electronics assembly workbenches?
An anti-static floor mat would reduce static generated by the carpet, but you can still build up a charge on your body, e.g. by taking off a coat or sweater. And depending on your shoes, it may take some time for any charge on your body to disspate through the mat.
Like a ground cable, a benchtop style mat will only be effective if you touch it prior to plugging in the peripherals.
Scotch Guard the carpet?
I assume you mean Static Guard. Scotch Guard protects from stains, not static.
The problems with Static Guard are that it needs to be re-applied periodically for it to remain effective, and it also leaves a waxy residue which will trap dirt.
Some other solution?
Besides the power strip, the closest metal to the PC is either a window frame or a doorway, both about 5 ft from the PC. Pointers to particular parts would be most appreciated.
I would not count on a window or door frame being a good ground. The ground lead (3rd prong) of your electrical circuit (which is normally connected to your PC's chassis via the PSU) is generally your best bet.
You could get a wired ESD wrist strap, and connect the wire to the metal case of the PC. You don't actually need to wear it all the time, just touch it for a second or two before plugging/unplugging peripherals to drain any residual charge.