Preheat the oven to 375°F. Spray a 9-inch square baking dish with cooking spray.
Make the potatoes: Place the potatoes in the prepared dish in three or four rows, depending on how wide the potatoes are. You don't want them to be tight; make sure you leave enough space so the potato slices are slightly slanted. Add the onion slices in between and on top of potatoes (basically wherever you can fit them).
Make the sauce: In a medium pot, melt the butter over medium heat. Whisk in the flour and cook, whisking consistently, until a paste forms, about 30 seconds. Slowly stream in the milk, continuing to constantly whisk away any lumps, until smooth and combined. Raise the heat to medium-high, bring the mixture to a boil, then reduce the heat to medium-low and simmer, stirring occasionally, until the sauce thickens and resembles a creamy gravy, about 5 minutes. Reduce the heat to low and stir in the Cheddar, salt, garlic powder, and a few grinds of pepper. Taste and add more salt and pepper, if necessary.
Bake the potatoes: Pour the sauce evenly over the potatoes and onions and cover the pan with foil. Bake for 45 minutes.
Top and serve: Remove the foil and sprinkle the potatoes with the Gruyére and Parmesan. Return to the oven and bake, uncovered, until the potatoes can be easily pierced with a fork and the top is nice and golden brown, 30 to 45 minutes. (If you'd like an extra crispy, golden topping, switch the oven to the broiler setting on high and broil for 1 to 2 minutes, watching closely to prevent burning.) Allow to cool for 10 minutes, then top with chives and serve warm.
To store: Keep any leftovers in an airtight container in the fridge for up to 5 days. Reheat in the microwave in 30-second intervals until heated through.
To make ahead: Assemble the au gratin as directed, but before baking, cover the dish with foil, and place it in the fridge for up to 1 day before serving. When you're ready to serve, bake as directed, adding 10 to 15 minutes to the baking time if needed.