Humans are interesting animals.
We are still 80% dependent on fossil fuels for our energy needs and have no clue what we could use at this scale when they're depleted.
The other interesting thing about humans is that they are all independent beings, so some of them can be thinking about and working on one thing, and others can be working on something completely different... at the same time!
But let's worry about what could happen to the sun in 5 billion years!
I think the death of the sun is the least of our worries -- it seems far more likely that humans will have been wiped off the planet by an asteroid collision. And that could happen at any time with little warning - even if we see it coming a decade in advance, there's very little we can do to preserve humanity in such a short time as we have zero real experience in creating a long term colony off the earth.
I can say with some certainty that the earth will not run out of fossil fuels in my lifetime, and probably not the lifetime of anyone reading Slashdot today. Fossil fuels will become increasingly expensive to extract after we hit the peak for each type, but coal reserves alone are huge and should last us until the end of the century. And while an life-ending asteroid strike is unlikely in my lifetime, it could happen tomorrow.