I felt the same with Electronic Engineering in my final year - because I had realised that what I was learning was so academically focused that it was almost useless in the real world. I forced myself to finish that last year, but I think that effort destroyed my love for electronic design work (fortunately, I fell into a software job instead, in part because I got my degree).
Perhaps if you can get out in the real world then you will find real problems and those will likely motivate you (if you are anything like me, anyway). The most motivated students I recall were already working, and they picked and chose relevant academic focus that could help them with their design work (i.e. they could get some value from the academic system). Even though work is often depressing in itself (varies on a huge number of factors).
Edit: perhaps relevant: I was depressed due to a relationship. She ended the relationship with me, and the next day I was long-term happy. Turns out situational depression is a thing, and that it is entirely different from clinical depression (which doesn’t fix itself in a day - exception fast bipolar?). If you feel unhappy, sometimes you have the ability to fix the situation that is making you unhappy!
I'd love to give you advice so much, however I forced myself through it and started to work in a different carreer.