1. Cut red and sweet onions in half lengthwise; peel and thinly slice crosswise. Cut off and discard dark green tops and root ends from leeks. Cut leeks in half lengthwise and rinse well under running water, flipping layers to release grit. Slice leeks thinly crosswise. Peel shallots and thinly slice crosswise.
2. In a 4- to 6-quart pan over medium-low heat, melt butter. Add red and sweet onions, leeks, and shallots. Sprinkle with 1 teaspoon salt. Cook, stirring occasionally and adjusting heat as necessary to prevent scorching, until onions are very soft and deep golden brown, about 1 hour.
3. Stir in broth, wine, and thyme; add pepper and more salt to taste. Bring to a simmer and cook, stirring occasionally, to blend flavors, about 10 minutes (see notes).
4. In a small bowl, mix Swiss and dry jack cheeses. Set ovenproof soup bowls on a baking sheet. Ladle hot soup into bowls. Float a slice of bread on each bowl of soup, then sprinkle each with 1/4 cup shredded cheese.
5. Broil soup about 8 inches from heat until cheese is bubbly and starting to brown, 2 to 3 minutes. Serve hot.