Comment 13 for bug 1667158

@experimancer Thank you for sharing.

Given that simply killing compiz process fixes the bad border problem, I have tested a solution that works on my Ubuntu 16.04 system every time after the system wakes. 2 steps solution. Hope it can help others.

Step 1:
I created a script called "fixbadborders" in the directory /lib/systemd/system-sleep.
It contained the following:
## This file (or a link to it) must be in the folder /lib/systemd/system-sleep/
## Purpose: Kill compiz after system wakes up from sleep.
## This will fix bad window borders caused by Nvidia driver 375.39.
kill $(ps -C compiz -o pid=)

Step 2:
Allowed the script to have executable permission with:
sudo chmod +x fixbadborders