Saute onions in butter in a saucepan over medium heat. Add garlic, thyme, salt and pepper and cook until the onions are soft and caramelized, about 25 minutes.
Add the wine, bring to a boil, reduce the heat and simmer until the wine has evaporated, about 5 minutes.
Sprinkle the flour over the onions and stir. Reduce the heat to medium-low and cook for 10 minutes, being careful the flour doesn’t burn. Also, make sure flour does not clump.
Stir in the chicken broth and bring the soup back to a simmer. Cook for 10 minutes.
Adjust salt and pepper, if necessary.
Top a piece of French bread with shredded Gruyere cheese and broil until the cheese is browned and bubbly.
Ladle the soup into a bowl, top with the toasted French bread and garnish with sliced green onion.