I struggle with this too. I’ve found having a hand written list of things to do when boredom hits helps me. Things like:
Walk Play the piano Read Play soccer Teach my kids the piano Read with my kids Teach my kids math Stretch Knees over toes exercise I should write more but can’t get over a mental block I seem to have.
I also like @User21000000 suggestion of calling someone you haven’t talked to in a while.
Things I try not to do are look at twitter, or any other mindless doom scrolling and other unproductive internet habits.
I sometimes try and trick myself into not falling into unhealthy unproductive habits by saying if I can check off every thing on my list for a given day then I give myself permission to indulge.