I know it feels "mean" to pen them in when they've been used to ranging. But try to observe them in their pen from a distance, when they don't know you're near. They will probably be contented, busy about their chicken business or just relaxing. It's when they see/hear you coming, or hear that tell-tale sound of a screen door slamming, that they start hoping for treats or release, then they rush to the fence & act like tortured prisoners. They'll enjoy OCCASIONAL treats in their pen, some green leafy weeds or a bit of veg or fruit, but they don't need to be entertained all day long.
It's difficult to have both thriving gardens & thriving chickens. You'll have to barricade one or the other. There are pretty ways to fence off a veg or annual garden. Otherwise, to a chicken the world is its salad bowl, and underneath is its dust-bath tub. I now have a thriving perennial bird -n- butterfly garden but it's taken some time to get things large & sturdy enough to withstand the chickens. I've had to sometimes fence off new plantings, and/or place pavers & bricks around the newly-planted roots to keep them from digging them up.
It's difficult to have both thriving gardens & thriving chickens. You'll have to barricade one or the other. There are pretty ways to fence off a veg or annual garden. Otherwise, to a chicken the world is its salad bowl, and underneath is its dust-bath tub. I now have a thriving perennial bird -n- butterfly garden but it's taken some time to get things large & sturdy enough to withstand the chickens. I've had to sometimes fence off new plantings, and/or place pavers & bricks around the newly-planted roots to keep them from digging them up.