Most of the window managers out there have their own guidelines for GUIs. When building cross-platform applications, like for OSX, Ubuntu and Windows, which guidelines should I follow?
There are ergonomy standards that exist (ISO-14915), and you can also find UI principles given by some companies. Apple aprovides some, I think Microsoft too, so you can take the common principles from both.
You can observe existing software and pick ideas (or make different) according to your needs and the application you want to develop.
A good start could be the wikipedia page https://en.wikipedia.org/wiki/Usability_engineering
Adobe Air does some of this, you might want to consider programming there. Just looking at screenshots of other apps might help you see what other apps are like. As lauhub said, some companies will give you design guidelines.
Generally you'll want to follow whatever guidelines apply to the target platform. If you're writing cross-platform, that may require you to make subtle changes to each and every target platform's user interface.
If you don't, you'll end up with something like old Java UIs - i.e. an interface that doesn't really fit in on any platform, which is surprisingly disturbing for peoples' workflow.