Take a ferry to Doolin, then bus to Shannon airport. If the same-day ferry or bus schedules don’t work with your flight at Shannon, you’d want to spend the night beforehand in Doolin, or closer to the Shannon Airport. We stayed at a B&B in Sixmilebridge, and there are also a hotels in the area.
You said it would need to be by bus or train, but I assume that means after you’d gotten back to the mainland from the islands. One other possibility would be to fly on one of the small Aer Arann planes from the Island of choice to the Connemara Airport, west of Galway. Then take buses from that small airport to Galway and then on to the Shannon airport. If there’s bad weather and rough seas, the planes are more reliable than the ferries, but will cost more and take longer, because the Connemara Airport is farther from Shannon than is Doolin.