If it's for fun, it shouldn't feel like work.
While others have some good suggestion, I'm going to ask the hard question: do you really want to be coding as a hobby?
The fact that you ask that question suggest you already code enough during work hours and you need to do something else after work.
Did you used to code for fun before it was your work? Then maybe it's a good idea to accept that you are not going to find in fun as long as your job is mainly coding (but it might become fun again if you don't mainly code as a job)
Did you drink the kool-aid that a developper is supposed to code for fun after work? Then maybe it's time to question that belief. A lot of professionnal developer that used to do that came to term with the fact that they'd rather do something else from their free time after coding all day.
After 10 years coding professionally, the only times I'm going to consider coding after work is as a mean to an end. There has been some occasions, but I wouldn't consider it "coding for fun". I wanted the results badly enough to dedicate some of my free time to getting that done despite not really enjoying the actual "coding" part.
Most of my free time is now used for anything but coding and I'm cool with that.
I would be very careful with this sentiment. Pretty much any creative endeavour consists of parts that are not strictly fun. Coding in particular is filled with difficulty, tediousness, deep and wide thinking, etc. It's also the best creative tool that I know of, deeply engaging, very intelectually stimulating and fulfilling and lets you create things of extreme sophistication with very little limits. It's easy to rationalize your lack of motivation or discipline with a statement like: "I don't feel like doing it so it must not be something that I like" but creating an environment and a mindset to pursue fun, creative projects is not easy.
I would agree that the fun/work line is different for everyone, but I would also submit that a really low bar can also lead to an interesting hobby life over the long term.
I would consider that I give up on stuff pretty early when it becomes "not fun [1]." I'm in my 50's and I've been doing it for a long time. Since I'm always obsessed with something and each time I try something I get at least a little better, I have built up a pretty decent background in a lot of different areas and the amount I can accomplish before something becomes "not fun" gets to be more and more. I like to say I have a Metahobby: I collect hobbies.
I know this isn't a viable solution for most, but at least it's an alternative to feeling crappy about not finishing stuff. Also this:https://youtu.be/GHrmKL2XKcE
[1] For hobby projects. In my career, I know it's work, someone's paying me.
I could have phrased it more carefully : "If it's for fun and none of it feels fun and all of it feels like work, maybe it's time to consider you don't really want to do that for fun".
Of course any creative endeavour is not only fun, but I know the feeling of trying to do something "for fun" and it ends up feeling like work. Some people like to hustle, and that's fine. But just not doing it and finding something else you find fun instead is something to keep in mind.
I thought the "maybes" and several questions made it clear, but I'll state it regardless: there is no one-size fits all answer, and what I said is just a possibility that should be kept in mind. While it happens to be the one that worked best for me, I'm aware it's not the answer for everyone.
I’m still a little drunk off said kool-aid. I have a hard time distinguishing between work and play when it comes to hacking on my work environment.
The ideal fun coding session would emerge as a byproduct from a particularly successful work-related session. In reality, when coding during times I’m not being paid, I find myself with similar headaches to the workplace.
I second this. After all these years of programming it's become something I do for work with the exception of the occasional Arduino project (something mentioned more than once in this thread). As a matter of fact, I don't use computers all that much in my free time, that includes smartphones. I prefer to go swimming, cycling, lift weights, bird watching, have a drink down the pub, hang out with friends, than to stare at a screen in my free time.
It's OK to be a programmer for 40 hours a week and be anything else in the remaining hours.
The fact that you ask that question suggest you already code enough during work hours and you need to do something else after work.
Did you used to code for fun before it was your work? Then maybe it's a good idea to accept that you are not going to find in fun as long as your job is mainly coding (but it might become fun again if you don't mainly code as a job)
Did you drink the kool-aid that a developper is supposed to code for fun after work? Then maybe it's time to question that belief. A lot of professionnal developer that used to do that came to term with the fact that they'd rather do something else from their free time after coding all day.
After 10 years coding professionally, the only times I'm going to consider coding after work is as a mean to an end. There has been some occasions, but I wouldn't consider it "coding for fun". I wanted the results badly enough to dedicate some of my free time to getting that done despite not really enjoying the actual "coding" part.
Most of my free time is now used for anything but coding and I'm cool with that.