What's the word for "doing useless things while you don't have anything to do"?

Solution 1:

Killing time is a common idiom for this kind of activity.

Example (from Dictionary.com definition 51 of time): While I was waiting, I killed time counting the cars on the freight trains.

Sometimes it carries the connotation that you have something better to do that you could be doing, but it is definitely used in this sense as well, as in the example.

Solution 2:

I use the word diddle or diddle away. I've also heard putter, as in: My grandfather likes to putter in the garden. Merriam-Webster online seems to support the definitions:

diddle: fiddle, toy —usually used with with

putter: : 1. to move or act aimlessly or idly 2.to work at random : tinker

And, I guesss tinker might work too.