Let the butter soften. Cut the onion into very fine cubes.
Fill a small saucepan about 2 cm with oil and fry the onions until golden brown. You should definitely stay on the stove, as the onions turn black very quickly when they turn brown. Place a stainless steel sieve on another saucepan and strain the fried onions. Let the onions cool.
Put the butter in a bowl and squeeze in the garlic clove. Add salt, pepper to taste and sugar. Mix with the cooled fried onions.
Put the butter in a cool place.
I do not discard the sieved oil, but keep it. It has a slight onion flavor and can still be used in many dishes.
The next day the butter tastes even better. We use them for baguettes, pan-fried or grilled.