Yes it is safe (my opinion; please read the final caveat at the bottom though!), but I do homework before I remove a desktop.
I'm a lover of multiple DEs & add/remove desktops somewhat regularly (its not common behavior, but I'll do it multiple times usually per six monthly release cycle, which is more than most I suspect) but I'd not write an generic answer for the question as any answer will be release specific.
It'll also depend how much you manually installed and how the desktop was installed (ie. via what meta package) & other factors too. In recent years I stopped adding the desktop (say the xfce
meta package & switched to xubuntu-desktop
which installs more, but I subjectively had less issues on removal)
I look at
- what I actually installed (what *meta packages I used)
- if I had any problems & left mines for myself by flipping packages to manually installed (eg. used
apt install -reinstall
will cause that package to be treated as manually installed even if it was dragged in by meta package initially; these can cause parts of the DE to be left behind on removal
- etc
It's details like this I explore before I run the apt remove
command. Even then I read the output before I say "y" to it; as I may have missed stuff, also did it report packages were being removed that I expected to be removed; if it doesn't look right I say "n" & explore why.
Note: historically my ISP let me download Ubuntu ISOs quota free; but not flavors; and upgrades & additional package installs were likewise quota free; thus I always installed a Ubuntu Desktop system, and installed/removed desktops as this was quota free; unlike downloading a flavor ISO which used quota..
This explanation isn't likely very easy, but I'm having trouble describing what I look for as I only really scan the output & come up with a feeling that's either "looks good", "something's missing", "not sure", or "no way - wrong!".
Either way I do on occasion have a less than perfect result (ie. "oops; missed that" moment) but within a minute or two I've worked out what was wrong & corrected it, and usually a logout/login proves it; or at worst a restart of the DM or reboot & it's golden again :)
ps: it's not a NEWBIE thing; but in my opinion, it's a great way to learn, as I learnt heaps from doing it, esp. fixing the occasional mess I'd make doing it !