Open mwotton opened 8 years ago
I am having the same issue, did you manage to resolve it?
I manged to solve it in a very hacky way.. dmenu works on xmonad and dmenu uses xlib.
It is possible to have a xlib + xcb connection open at the same time
// X lib connection
Display * xlib_connection = XOpenDisplay(NULL);
/* Connect to the X server. */
xcb_connection_t *connection = XGetXCBConnection(xlib_connection);
then using the focus function from dmenu (re-written slightly)
void grab_focus(Display *display, xcb_window_t *window) {
struct timespec ts = { .tv_sec = 0, .tv_nsec = 1000 };
Window focuswin, mainwin = *(Window*)window;
int i, revertwin;
for (i = 0; i < 100; ++i) {
XGetInputFocus(display, &focuswin, &revertwin);
if (focuswin == mainwin)
return;
XSetInputFocus(display, mainwin, RevertToParent, CurrentTime);
nanosleep(&ts, NULL);
}
}
Then calling that inside the event handlers instead
case XCB_EXPOSE: {
/* Get the input focus. */
grab_focus(xlib_connection, &window);
/* Redraw. */
redraw_all(connection, window, cairo_context, cairo_surface, query_string, query_cursor_index);
break;
}
I am sure this is a terrible solution to anyone who actually has any experience with this kind of stuff. But atleast it lets me use this awesome tool with Xmonad as well.
I made a fork, https://github.com/JonasRSV/lighthouse with the fix. Don't know if it is worthy of a PR.. If it is im happy to make it, otherwise I'll just leave it at this.
when i run dmenu, keyboard focus goes straight to the input. with lighthouse, i seem to have to move the mouse to the window.
I tried poking it a bit:
but got
any help in debugging would be appreciated, lighthouse looks like exactly what i'm after (just want to hook it up to https://github.com/mwotton/dustme )