Junkie,
You have a couple of considerations here.
If, as you state, your wife is not providing a good environment for the kids and you don't think it has much chance of improving, you are right in considering gaining primary custodianship.
However, legal action without trying to work with your wife might not be best. Her lawyer will work to convince her to fight it as he will get paid more for the fight.
Your wife might be willing to give up custody. She might be aware that she is not providing the best for her children, but is not willing to openly admit she is "a bad mother". Perhaps asking for primary custody until she is able to get things in order might go over better, but that will be out of court and away from lawyers. Try to find some way for her to gain some "high ground" here.
She also might be concerned that should you get primary custody, she could be responsible for child support.
Letting her know she won't be asked for child support and finding a way where she can give up custody without admitting she is bad for her children might get you to where you want to be.
Good luck and strength in all this, you are going to need all you can get.
Remember your goal is to provide the best for your children, not so show your wife where she has been wrong.
Take care.