Desktop Environment Switch (Cinnamon > Gnome)

Make a backup and then do it?

I can see this working out OK, if with some minor leftover cruft in some corners.

By the way … mapare could be abused for this purpose, and would appear to provide a more full package list.

First to install all needed packages:

bash <(curl -s https://gitlab.com/cscs/mapare/-/raw/main/mapare) -IA

(and input your desired desktop at the prompt)

Then to create a list of non-default packages

bash <(curl -s https://gitlab.com/cscs/mapare/-/raw/main/mapare) -X | tee mapareout.txt

(and input your new DE)

Now you will probably want to open up that file (mapareout.txt) and delete any lines with packages you want to keep - probably mostly AUR or other extra programs you have added.

Then you can uninstall everything on the list using the following:

grep -Ev '^ |^$' mapareout.txt | sudo pacman -Rns -

And that should cover most things except what is in your $HOME directory.
Any ~/.config/* or ~/.local/* or ~/.cache/* or similar directories from any previously installed packages will not have been automatically removed.

You may opt to try cleaning it yourself, maybe even consider comparing to the skel (default for new users) files at /etc/skel OR just create a new user, maybe moving any important files over to the new user account (and $HOME).

PS

I suppose I should make clear…

A clean install is always going to be clean.
If theres no particular reason to go about it another way then this is going to be the steadfastly reliable approach.