Melt the butter in a skillet over medium-low heat. Add the onions and cook for 25 to 30 minutes, stirring often, until soft and deeply golden.
Cook the Pasta and Potatoes:
Bring a large pot of salted water to a boil. Add the potatoes and cook for 5 minutes.
Add the macaroni to the same pot and cook until the pasta is just tender and the potatoes are cooked through. Reserve 1 cup of cooking water, then drain.
Finish:
Warm the cream and milk in the pot over low heat. Add the cheeses gradually, stirring until smooth.
Fold in the drained macaroni and potatoes. Season with the salt and pepper, adding a little reserved cooking water if the sauce is too thick.
Spoon into bowls, top with caramelized onions, and serve the apple compote alongside.
Notes
Keep the heat low after adding the cheese so the sauce stays smooth rather than separating.
Gruyère alone can replace the Appenzeller for a milder result.