How to show/hide desktop icons on macOS

I often want to do this while doing a demo or filming my screen so I’m writing this down so I remember. I found this on osxdaily.com and have amended it slightly. Maybe this is a mac app I could make…

To hide:

defaults write com.apple.finder CreateDesktop -bool false && killall Finder

To show:

defaults write com.apple.finder CreateDesktop -bool true && killall Finder