kupferlauncher / keybinder

``keybinder`` is a library for registering global key bindings, for gtk-based applications in X11. With gir bindings.
MIT License
111 stars 17 forks source link

<Shift><Alt>T not working #7

Open ElijahLynn opened 8 years ago

ElijahLynn commented 8 years ago

Hi,

Using keybinder as part of https://github.com/Guake/guake and ran into an issue where I cannot bind T. https://github.com/Guake/guake/issues/759

Looking for any noob assistance in debugging this. I write PHP/JS but this is deeper than I know how to debug right now. Any guidance appreciated.

I downloaded the example at https://raw.githubusercontent.com/engla/keybinder/master/examples/example.py and it worked with the <Ctrl>A shortcut by default. I changed it to <Shift><Alt>T and it stopped working so it appears something is funky with my keybinder.

$ locate keybinder
/usr/lib/libkeybinder.so.0
/usr/lib/libkeybinder.so.0.1.0
/usr/lib/pyshared/python2.7/keybinder
/usr/lib/pyshared/python2.7/keybinder/_keybinder.so
/usr/lib/python2.7/dist-packages/keybinder
/usr/lib/python2.7/dist-packages/keybinder/__init__.py
/usr/lib/python2.7/dist-packages/keybinder/__init__.pyc
/usr/lib/python2.7/dist-packages/keybinder/_keybinder.so
/usr/share/doc/libkeybinder0
/usr/share/doc/python-keybinder
/usr/share/doc/libkeybinder0/AUTHORS
/usr/share/doc/libkeybinder0/README
/usr/share/doc/libkeybinder0/changelog.Debian.gz
/usr/share/doc/libkeybinder0/copyright
/usr/share/doc/python-keybinder/changelog.Debian.gz
/usr/share/doc/python-keybinder/copyright
/usr/share/pyshared/keybinder
/usr/share/pyshared/keybinder/__init__.py
/var/cache/apt/archives/libkeybinder0_0.3.0-2_amd64.deb
/var/cache/apt/archives/python-keybinder_0.3.0-2_amd64.deb
/var/lib/dpkg/info/libkeybinder0.list
/var/lib/dpkg/info/libkeybinder0.md5sums
/var/lib/dpkg/info/libkeybinder0.postinst
/var/lib/dpkg/info/libkeybinder0.postrm
/var/lib/dpkg/info/libkeybinder0.shlibs
/var/lib/dpkg/info/libkeybinder0.symbols
/var/lib/dpkg/info/python-keybinder.list
/var/lib/dpkg/info/python-keybinder.md5sums
/var/lib/dpkg/info/python-keybinder.postinst
/var/lib/dpkg/info/python-keybinder.prerm
ElijahLynn commented 8 years ago

I did attempt the example main.c thinking it is the python-keybinder keybindings that is the culprit. But with main.c I keep getting an error that it can not find keybinder.h. I think I need to install it somewhere, working on that still.

ElijahLynn commented 8 years ago
$ sudo apt-cache policy libkeybinder0
libkeybinder0:
  Installed: 0.3.0-2
  Candidate: 0.3.0-2
  Version table:
 *** 0.3.0-2 0
        500 http://us.archive.ubuntu.com/ubuntu/ trusty/universe amd64 Packages
        100 /var/lib/dpkg/status
ElijahLynn commented 8 years ago
$ sudo apt-cache policy python-keybinder
python-keybinder:
  Installed: 0.3.0-2
  Candidate: 0.3.0-2
  Version table:
 *** 0.3.0-2 0
        500 http://us.archive.ubuntu.com/ubuntu/ trusty/universe amd64 Packages
        100 /var/lib/dpkg/status
ElijahLynn commented 8 years ago

Hrm, maybe I should just include the path of https://github.com/engla/keybinder/blob/master/libkeybinder/keybinder.h in the main.c file instead of just keybinder. Will try that soon.

ulidtko commented 8 years ago

Did you try <shift><meta>T ?

As far as I remember, the gtk_accelerator_parse function is quite finicky.

Also, I'm not sure what binds Ctrl-Alt-T as the default terminal shortcut, so there could be a conflict with that.

ElijahLynn commented 8 years ago

There is a Ctrl-Alt-T default in Ubuntu with the Terminal application. However, I am using Shift-Alt-T though, which doesn't appear to have a conflict. When I do use the conflicted Ctrl-Alt-T, I do get a warning of "\ (example.py:20382): WARNING **: Binding 'T' failed!" but Shift-Alt-T doesn't give me a warning.

ElijahLynn commented 8 years ago

I get a "\ (example.py:21474): WARNING **: Failed to map virtual modifiers" when using <Meta><Shift>T or <Shift><Meta>T.

ElijahLynn commented 8 years ago

I am having the same issue with <Ctrl><Shift>V in the example. Ultimately leads to me not being able to copy/paste in Guake.

ElijahLynn commented 8 years ago

When I do press the problem key combos the terminal of the example.py app does respond by blinking the cursor rectangle. If I hold down on the key combo it turns into a rectangle with an outline, and as soon as I let go it is a filled in rectangle again. So it does appear it is getting the combo, because if I press a different combo, it actually prints something to the screen.

darksylinc commented 7 years ago

Arrrghhhhh!!! This bug is annoying me.

I fired up the debugger and libkeybinder is getting the key combination, but it translates Shift+Super+a (for example) into Super+A (uppercase A) and thus it thinks the key combination was not pressed. Lunch is ready. Will look further when I get back.

darksylinc commented 7 years ago

OK I know what's going on.

I've created the PR https://github.com/engla/keybinder/pull/10 to fix this issue.

keybinder has two main branches: master and keybinder-3.0

As a result, the former is more popular. The 3.0 branch has already solved this issue by introducing the function keybinder_set_use_cooked_accelerators but the original 2.0 branch has no such fix/workaround. So I've implemented my own.

I've implemented keybinder_set_avoid_cooking_shift_accelerators. Calling keybinder_set_avoid_cooking_shift_accelerators( false ); will use the old behavior. The default is now enabled because the lack of Shift modifiers is extremely annoying.

I've included the python binding to toggle this workaround.

If the matter is urgent and the PR doesn't get accepted quickly, use my fork https://github.com/darksylinc/keybinder I will not provide user-support however. Compile it on your own.

Now I can finally use Shift+Super+1 in dockbarX to launch new instances of a pinned application.

ElijahLynn commented 7 years ago

This is awesome!! Now I need to figure out how to install Keybinder so Guake uses it!

Thanks

gsemet commented 7 years ago

I don't see this issue, Ctrl+Shift+C/V works well with libkeybinder on ubuntu 14 and 15