Heat the oven to 375°F and grease a 9-by-13-inch baking dish.
Melt the butter in a saucepan, whisk in the flour for 1 minute and gradually whisk in the warm milk.
Simmer until slightly thickened, then stir in the Dijon, 1 teaspoon salt, black pepper and thyme.
Layer the potatoes and onion in the dish, pour over the sauce and cover tightly with foil.
Bake for 35 minutes, then season the chicken with the remaining salt and arrange it over the potatoes.
Cover and bake until the potatoes are tender and the chicken reaches at least 165°F, 25 to 30 minutes.
Uncover, add the Gruyere and bake until browned, about 10 minutes.