To use a PS3 DualShock controller for PC games in Windows, I used the ScpToolkit driver, and followed this guide.
It tells you to install these prerequisities:
Note: Linux support for the PS3 controller seems to be good. It worked for me right away on my laptop.
For some Steam games, it's necessary to change the controller layout. To do this, right click the game in the Steam library -> Manage -> Controller Layout. Then download one of the community layouts. I had to do this for Final Fantasy VII, for which the default controller layout was very bad and the D-Pad didn't work at all.