Does anyone have a link or document on how to write a screensaver for Linux?
Here's some info on xscreensaver that you may find of use: xscreensaver also there's an FAQ here.
There's a simple tutorial here too: simplesquares (from the first link)
This might be of interest to you:
http://www.jwz.org/xscreensaver/faq.html#writing-savers
it's from the xscreensavers homepage, it's sort of the de facto screensaver
Google "xscreensaver", and you can learn from its code, rather than starting from scratch.