Package lsw

Prints all window titles of DISPLAY to standard output

http://tools.suckless.org/lsw

Lists the titles of all running X windows to stdout, similar to ls(1). Might
be useful for script integration.

General Commands (Section 1)
lsw
lsw prints the title and XID of each child of each window. If none are given the root window is used.