Use x11-prop to encode properties

Also added some tests and fixes found while implementing the tests