The opposite. I learned this only recently because I was doing things like fasting for the last few months, and I also changed my diet to completely cut carbs. I happened to get my method complete in that time and get through most of the work I was doing to tie up loose ends(sell/donate my possessions, etc), and had planned for April. It's now April and everything is in limbo. I have everything ready, and I have near-zero actual drive to die or finish working on it compared to before. This also happened 5-6 years before, when I had a method mostly complete ,... so... it's not clear to me how much of it is "you stop wanting to die once you complete your method" and how much of it is "carb based diets have a relationship with depression and can make you less suicidal". I've noticed lots of different health improvements from having zero carb intake+strength training.
I tried some ice cream once in this four month period by the way, and holy shit... it was like a taking drug whose sole effect was to make you feel like absolute shit. It was amazing. So... who the hell knows, maybe sugar is just really, really bad and basically depression fuel, but we're so used to it that it's hard to tell. There are some theories about gut bacteria too and sugar, and it's all really complicated so... this is all probably pretty personal and you'll have to just try stuff for long periods of time to see what works. Elimination diets are really useful that way too.
But if you're of the recovery bent, and you're desperate to be less depressed/suicidal, then maybe just try gradually reducing carbs for a few months. Could be worth it as an experiment.
Edit: Oh, and you can gain weight on anything, but the specific problem with carbs, to put it crudely: First of all they spike your insulin. Insulin blocks leptin, which is the thing that says, "Hey, we have lots of extra fat around over here... you uh... totally don't need to eat more , eating more is a terrible idea". So what happens is, you just eat and eat and eat when you're playing the whole carbs and insulin game. That's partly why you feel very full and satisfied and hunger free on diets that involve no carbs. It gets much more complicated than that with all kinds of things, like fiber and what carb it is, but that picture is a fairly typical picture.