Slice onions into 1/4-inch slices. In a large bowl, combine onions and salt. Let sit 1 hour, stirring occasionally. Rinse and drain onions.
Slice habañeros into 1/4-inch rings and remove seeds. If also adding Thai chilies, do the same with them. Combine peppers and onions.
In a medium saucepan, combine vinegar and sugar. Bring to a boil over medium heat and boil 1 minute. Reduce heat allow to simmer.
Prepare 4 hot, sterilized pint mason jars.
Into each jar add 1 teaspoon mustard seed and a clove of garlic. Pack peppers and onions into the jars and pour over hot brine leaving 1/2-inch headspace. Remove air bubbles, clean rims of jars and attach two piece lids.
Process in a boiling water bath for 10 minutes. Makes 4 pints.