How these fundamental features work in macOS, using the pboard daemon and UTIs. With full log transcripts too.
Adding sub-commands to write the contents of textboxes to the pasteboard: a simple task, but so easy to get hopelessly lost in it.
The Desktop and Finder illusions are held together by Launch Services, which associates file types with apps. This and more now hinge on the UTI.