I'm also programming since over 20 years. While there are times, tasks and aspect which I don't like too much, or which can be depressing, overall I still enjoy it.

But maybe let me add some random points:

- I do side projects from time to time. All of the open source on GitHub. Either in some new programming language which I want to learn about and just try out, or some preferred well-known programming language but a new fun (maybe challenging) task. Or maybe not challenging but actually easy but still fun, e.g. like writing a small game. There are many possible variations and options for side projects, and each case can be rewarding. As you start from scratch, you can try out whatever you want. If you set the scope small enough, you can soon get some nice results. Maybe really the most fun side project is to write some small game. Side projects is also one of the best ways to widen your scope to new areas. Maybe also the only option. In some cases (but this should not be the focus), you can integrate the side project back into your day-to-day work.

- Maybe the project you currently work is too big, buggy, unorganized, and annoying to work with. Take a step back and think about ways how to solve some of the annoyances. Maybe some subsystem can be rewritten. Maybe the startup time is too long and this can be solved somehow. Invest some work in making your workflow easier. Turnaround time for development is important. Maybe you can develop a testing environment where the turnaround time of development and testing can be much faster. There are many options here. Many of the will require some initial work but this can be greatly rewarding. In general, for me the most annoying thing is when something is slow. When I need to wait too long until I see the result of sth I just tried out. It could also help to get some better hardware.

- Other hobbies despite programming can be important too. Probably most relevant is some sort of sport, or any activity for the body. Hiking in the nature can be nice too. Take frequent off-times. Make this regularly such that it becomes a routine. E.g. I have a couple of sport courses, some in the mid of the day (so this is my extended lunch break), some in the evening. They force me to stop the work I'm doing right now. This is often a good thing because it forces you to take a step back and rethink about what you are working on right now, if you really tackle it from the right angle, or if you maybe should shift your priorities on other things. And also this gives you time in developing some new ideas, maybe about your work, or also new fun side projects, or new other unrelated hobbies.

- Socialize. Talk with other people. If you live alone, maybe change that. Talking can also be technical. I enjoy it, to get some new input, or talk about some new technical thing I read about, or maybe also something I don't know too much about. Talking can also be non-technical, about random stuff, about your hobbies, etc. If you are in a group with other shy people, just talk whatever is in your mind right now, even if the other people might not have a solution. Just talking about your programming problem, or whatever, helps.