You are not logged in.
The C code definitely has absolutely nothing to do with the window manager.
I understand this makes no sense. But can't think of other variables.
EDIT: damn, the variable is the window type itself. Got successful fetches for Skype, Keepassx; segmentation fault for Chromium, Geany and Keepass2.
Last edited by azb (2013-04-06 15:39:53)
Offline
You say it works on terminals, but not other windows, right? What other windows have you tried. I just tried it on mousepad, luakit, and firefox, and it worked fine.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
Indeed, most of the window types return 'Segmentation fault', only few other types succeed. Couldn't find other window types that work for me.
Got help from stackoverflow and solved it with python instead:
import Xlib.display
def get_active_window():
display = Xlib.display.Display()
window = display.get_input_focus().focus
#wmname = window.get_wm_name()
wmclass = window.get_wm_class()
if wmclass is None: #or wmname is None:
window = window.query_tree().parent
wmclass = window.get_wm_class()
#wmname = window.get_wm_name()
winclass=wmclass[1]
#print winclass
return winclass
Last edited by azb (2013-04-06 19:49:47)
Offline