Setting X11 window properties with xprop

xprop is a program that can list and set X11 window properties. Listing properties is really simple: just run xprop and click on the window that you are interested in, or use the -root or -id command line parameters to choose the “root” window or a window by ID. What’s not so clear is how the properties can be set; the manual does not give any examples.

In order to set a property you have to define the data format. This consists of the bit-width and data type: for example a string of 8-bit characters is 8s. A 32-bit hexadecimal integer is 32x, these are useful for example for window IDs. The widths and data types that can be used are documented in the manual page.

Here’s a simple example: PulseAudio uses a property called PULSE_SERVER on the root window to know which audio server is used in the desktop session. To redirect the audio to a PulseAudio server on another host over TCP/IP you can use:

xprop -root -f PULSE_SERVER 8s -set PULSE_SERVER tcp:otherhost:4713