Lucerne has a few trolley lines. They are ONLY trolley buses. The long, 3 Segment ones. Then, some 1 Segment hybrid buses that have pantagraphs. At the end of those lines, there is a longer stop where the trolley lines end, the pantagraph gets pulled down and the bus trucks along the last few stations with diesel.
Then theres just normal hybrid buses for more rural lines, and a battery operated bus that goes up and down a hill.
There’s a solution for every line - you just need the proper infrastructure. The reason that we have this great pantagraph-compatible infrastructure is that, while there are a lot of trains in Switzerland, there is no metro. So in lucerne, the trolley buses work almost as a metro, with the main lines having buses every 7 minutes.