vimist / xtmon

An EWMH compliant X window title monitoring tool.
10 stars 0 forks source link

Segfault on Line 157 #1

Open vimist opened 4 years ago

vimist commented 4 years ago

Bug report by chibinchobin on Reddit

Hey so I really like the idea of this program, but it segfaults when I try to run it.

The segfault occurs at line 157 when trying to call xcb_get_property_value_length and I'm not sure why.

I'm using musl libc and am running X11 without a proper window manager (currently just using wmutils + compton), but the same thing happens if I use tinywm. Any idea what might be going on?

https://github.com/vimist/xtmon/blob/20c887d44d7befc9682fa9ed6962470d7977667f/xtmon.c#L157

vimist commented 4 years ago

I would guess that this is because you aren't using an EWMH compliant window manager. Getting a list of top level windows in X (i.e. the ones you'd expect to see in a window switcher) isn't as straight forward as you'd hope (or at least as I had hoped). There doesn't actually seem to be a way to do this with just X (that I could find). This means that we have to rely on a few standards to help us out, namely ICCCM and EWMH.

If your window manager complies to the EWMH standard (the majority of them do), a property should be set on the root window called _NET_CLIENT_LIST (you can manually query this with xprop -root _NET_CLIENT_LIST); this contains a list of window IDs that the window manager is managing. If you look on line 151, you'll see this is what we're querying for.

As you're not using a window manager, I would be fairly certain this property won't be set and updated, which is why there's an error.

To sum up: I'll add some error handling in there to catch this possibility, but I don't think this tool will work for you unless you have something (i.e a window manager) managing the _NET_CLIENT_LIST property on the root window along with the _NET_WM_NAME / WM_NAME properties (that store the actual window titles) on each window itself.

I would be interested in what xprop -root _NET_CLIENT_LIST returns for you if you do get a chance to run it, just to confirm my suspicions. I assume it'll say _NET_CLIENT_LIST: no such atom on any window., but it'd be nice to know for sure.

Hopefully that explains the issue you're having and I'm sorry it's not going to be useful to you :(

vimist commented 4 years ago

That does seem like it's the problem. I need to add in some error checking to ensure a compliant window manager is running first.