Focus bug with launching keynav from xbindkeys

144 views
Skip to first unread message

Colin Shea

unread,
Dec 31, 2009, 4:56:45 PM12/31/09
to keynav...@googlegroups.com
Thanks a lot for the quick response, and quick implementation!

It's just a weird issue, however. I can launch keynav from xbindkeys like so:

   (xbindkey '(Mod4 r) "keynav 'start, grid 2x2'")

(The grid part may be redundant but I think it's nice to be explicit rather than implicit, esp in software). For anyone confused about the scheme-ish syntax, XBindkeys has support for Guile-based configs, which have the benefit of being able to do key-chords. See xbindkeys(1) (around line 120) for more information.

Anyways, keynav's grid is drawn and the process stays around (kill <pid> to remove it) but I can't control it. For whatever reason, after being launched from xbindkeys (I presume) keynav loses/never gets focus, and everything is passed through to the underlying application. Even clicks.

Note: This might be the big factor: I'm used the tiling WM, Awesome[1] and have it set to full-screen everything. I'll play with it's configuration (like exempting keynav from it's rules) and see if that helps.

Thanks for keynav!
--
Colin Shea

Jordan Sissel

unread,
Dec 31, 2009, 5:05:47 PM12/31/09
to keynav...@googlegroups.com
On Thu, Dec 31, 2009 at 1:56 PM, Colin Shea <co...@evaryont.me> wrote:
> Thanks a lot for the quick response, and quick implementation!
>
> It's just a weird issue, however. I can launch keynav from xbindkeys like
> so:
>
>    (xbindkey '(Mod4 r) "keynav 'start, grid 2x2'")
>
> (The grid part may be redundant but I think it's nice to be explicit rather
> than implicit, esp in software). For anyone confused about the scheme-ish
> syntax, XBindkeys has support for Guile-based configs, which have the
> benefit of being able to do key-chords. See xbindkeys(1) (around line 120)
> for more information.
>
> Anyways, keynav's grid is drawn and the process stays around (kill <pid> to
> remove it) but I can't control it. For whatever reason, after being launched
> from xbindkeys (I presume) keynav loses/never gets focus, and everything is
> passed through to the underlying application. Even clicks.

That's weird, given the "start" actually calls XGrabKeyboard so all
keyboard events should go to keynav.

As a tip, using keynav the way you want will require changing all
keybindings to 'quit' after each 'end', example:
Original usage: Escape end
Your usage: Escape end, quit

Assuming keynav is otherwise working correctly, this will cause keynav to exit.

>
> Note: This might be the big factor: I'm used the tiling WM, Awesome[1] and
> have it set to full-screen everything. I'll play with it's configuration
> (like exempting keynav from it's rules) and see if that helps.

I use ion, but I don't fullscreen everything.

In theory, keynav should be exempted anyway given it sets
override_redirect (a signal to windowmanagers to not manage them).

I'll try installing Awesome and xbindkeys so I can reproduce this.

-Jordan

>
> Thanks for keynav!
> --
> Colin Shea
>

> --
>
> You received this message because you are subscribed to the Google Groups
> "keynav-users" group.
> To post to this group, send email to keynav...@googlegroups.com.
> To unsubscribe from this group, send email to
> keynav-users...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/keynav-users?hl=en.
>

Jordan Sissel

unread,
Dec 31, 2009, 6:07:35 PM12/31/09
to keynav...@googlegroups.com
On Thu, Dec 31, 2009 at 2:05 PM, Jordan Sissel <j...@semicomplete.com> wrote:
> On Thu, Dec 31, 2009 at 1:56 PM, Colin Shea <co...@evaryont.me> wrote:
>> Thanks a lot for the quick response, and quick implementation!
>>
>> It's just a weird issue, however. I can launch keynav from xbindkeys like
>> so:
>>
>>    (xbindkey '(Mod4 r) "keynav 'start, grid 2x2'")
<snip>

>> Anyways, keynav's grid is drawn and the process stays around (kill <pid> to
>> remove it) but I can't control it. For whatever reason, after being launched
>> from xbindkeys (I presume) keynav loses/never gets focus, and everything is
>> passed through to the underlying application. Even clicks.
>
> That's weird, given the "start" actually calls XGrabKeyboard so all
> keyboard events should go to keynav.

Confirmed the problme you described happens with xbindkeys.

XGrabKeyboard is returning AlreadyGrabbed. I bet xbindkeys grabs the
keyboard on first-level keybindings in anticipation of chained key
combinations, or something like that.

I'll devise a clever workaround :)

-Jordan

Jordan Sissel

unread,
Dec 31, 2009, 7:24:20 PM12/31/09
to keynav...@googlegroups.com

Fixed!

http://semicomplete.googlecode.com/files/keynav-20091231.03.tar.gz

The workaround was to try calling XGrabKeyboard a few times in a loop,
with small (10ms) sleeps in between failures. After a certain number
of failures (20, right now), we will give up 'start' and abort.

I've tested this xbindkeys doing this:
(xbindkey '(Control semicolon) "exec keynav 'start, grid 2x2'")

Works for me; can you confirm?

-Jordan

Colin Shea

unread,
Dec 31, 2009, 7:54:51 PM12/31/09
to keynav...@googlegroups.com

Sadly, no. It seems that keynav gives up. Also, running that version, with just "keynav" (did it by accident, heh) nets a X Error of failed request:  BadAccess (attempt to access private resource denied with the major opcode being 33, X_GrabKey.

Jordan Sissel

unread,
Dec 31, 2009, 8:01:12 PM12/31/09
to keynav...@googlegroups.com

:(

Can you run 'xbindkeys -v' and press whatever keystrokes you need to
activate keynav, then copy that output here?

Also, a failure in XGrabKey means likely that the key combination was
already grabbed. Given the way you launch keynav, you don't need
anything in .keynavrc that binds to 'start'. If you think you need
them, you should look for conflicting keybindings between xbindkeys
and keynavrc bindings that use 'start' - Keynav will only XGrabKey
things that have 'start' in the binding.

-Jordan

Evaryont

unread,
Dec 31, 2009, 8:12:54 PM12/31/09
to keynav-users

Here's the output: http://pastebin.com/m30ed2908 Each yellow-
background line is my prompt, with the command entered.

Just fyi, the "PSG" command is a zsh alias I have to `ps wwwaux | grep
-v grep | grep` since I do lots of process searching that way. Which
may be wrong, but it works quite well for me! :)

--
Colin Shea

Evaryont

unread,
Dec 31, 2009, 8:24:32 PM12/31/09
to keynav-users
On Dec 31, 8:12 pm, Evaryont <co...@evaryont.me> wrote:
> On Dec 31, 8:01 pm, Jordan Sissel <j...@semicomplete.com> wrote:
>
>
>
> > On Thu, Dec 31, 2009 at 4:54 PM, Colin Shea <co...@evaryont.me> wrote:
> > > On Thu, Dec 31, 2009 at 19:24, Jordan Sissel <j...@semicomplete.com> wrote:
>
> > >> Works for me; can you confirm?
>
> > >> -Jordan
>
> > > Sadly, no. It seems that keynav gives up. Also, running that version, with
> > > just "keynav" (did it by accident, heh) nets a X Error of failed request:
> > > BadAccess (attempt to access private resource denied with the major opcode
> > > being 33, X_GrabKey.
>
> > :(
>
> > Can you run 'xbindkeys -v' and press whatever keystrokes you need to
> > activate keynav, then copy that output here?
>
> > Also, a failure in XGrabKey means likely that the key combination was
> > already grabbed. Given the way you launch keynav, you don't need
> > anything in .keynavrc that binds to 'start'. If you think you need
> > them, you should look for conflicting keybindings between xbindkeys
> > and keynavrc bindings that use 'start'  - Keynav will only XGrabKey
> > things that have 'start' in the binding.
>
> > -Jordan
>
> Here's the output:http://pastebin.com/m30ed2908Each yellow-

> background line is my prompt, with the command entered.
>
> Just fyi, the "PSG" command is a zsh alias I have to `ps wwwaux | grep
> -v grep | grep` since I do lots of process searching that way. Which
> may be wrong, but it works quite well for me! :)
>
> --
> Colin Shea

I forgot to mention, that in the second round of xbindkeys pasted
there, Keynav's grid never showed up. At all. :/

Evaryont

unread,
Dec 31, 2009, 8:27:35 PM12/31/09
to keynav-users
On Dec 31, 8:24 pm, Evaryont <co...@evaryont.me> wrote:
> I forgot to mention, that in the second round of xbindkeys pasted
> there, Keynav's grid never showed up. At all. :/

Oh, I see. Just ran `PSG keynav` and it shows 4 keynav processes
running.

LOL! Just tried 'Ctrl-;' and it works! Which is weird.

Jordan Sissel

unread,
Dec 31, 2009, 8:37:37 PM12/31/09
to keynav...@googlegroups.com

I have a psg alias too ;)

Unrelated problem: you'll want to remove the 'daemonize' command from
your keynavrc. Also, I left something dumb out when I was moving code
around after testing.
Fixed version: http://semicomplete.googlecode.com/files/keynav-20091231.04.tar.gz

Try the above version (.04) and let me know :)

-Jordan

Colin Shea

unread,
Dec 31, 2009, 8:48:33 PM12/31/09
to keynav...@googlegroups.com
On Thu, Dec 31, 2009 at 20:37, Jordan Sissel <j...@semicomplete.com> wrote:
I have a psg alias too ;)

Unrelated problem: you'll want to remove the 'daemonize' command from
your keynavrc. Also, I left something dumb out when I was moving code
around after testing.
Fixed version: http://semicomplete.googlecode.com/files/keynav-20091231.04.tar.gz

Try the above version (.04) and let me know :)

-Jordan


Yay! It works!

Brilliant. And fast. I may just be able to retire my mouse.

Jordan Sissel

unread,
Dec 31, 2009, 9:03:49 PM12/31/09
to keynav...@googlegroups.com

Awesome, I'm glad we got it working for you. Let me know if there's
anything else I can add :)

Happy new year!

-Jordan

Reply all
Reply to author
Forward
0 new messages