Preheat the oven to 350°F (175°C).
In a large skillet, melt the butter and olive oil over medium heat. Add the sliced onions, salt, and sugar. Cook, stirring occasionally, until the onions are caramelized and golden brown, about 20-25 minutes.
Stir in the minced garlic and thyme, cooking for another 2-3 minutes until fragrant.
Sprinkle the flour over the caramelized onions and stir to combine, cooking for an additional minute.
Gradually pour in the beef broth, stirring continuously to avoid lumps. Bring the mixture to a simmer and cook for about 5 minutes until slightly thickened.
Remove the skillet from heat and stir in the Gruyère and Swiss cheeses until melted and combined.
In a greased casserole dish, layer half of the cubed French bread on the bottom. Pour half of the onion mixture over the bread. Repeat the layers with the remaining bread and onion mixture.
Top the casserole with additional Gruyère cheese to taste.
Bake in the preheated oven for 25-30 minutes, or until the cheese is bubbly and golden brown on top.
Remove from the oven and let it cool for a few minutes before garnishing with fresh parsley, if desired. Serve warm.