You are not logged in.

#1 2015-02-05 23:59:32

quasar
Member
Registered: 2014-01-18
Posts: 3

[solved] What's wrong with xbindkeys ?

Hello,

After an update last month, xbindkeys doesn't work anymore. I first thought it was comming from the package update from version 1.8.5-4 to 1.8.6-1. But the downgrading changes nothing.

So, I decided to reduce my ~/.xbindkeysrc to a very simple key binding:

"xdotool key o"
   b

Then, I have tested the command with:

$ sleep 3 && xdotool key o

and it works fine, the letter 'o' is output as expected. So, the problem is from xbindkeys. Here is what I get:

$ xbindkeys -v
displayName = :0
rc file = /home/user/.xbindkeysrc
rc guile file = /home/user/.xbindkeysrc.scm
getting rc guile file /home/user/.xbindkeysrc.scm.
WARNING : /home/user/.xbindkeysrc.scm not found or reading not allowed.
1 keys in /home/user/.xbindkeysrc

min_keycode=8     max_keycode=255 (ie: know keycodes)
"xdotool key o"
    b
starting loop...
# when I press the key "b"
Key press !
e.xkey.keycode=24
e.xkey.state=16
"xdotool key o"
    b
got screen 0 for window 264
Start program with fork+exec call
Key press !
e.xkey.keycode=27
e.xkey.state=16
Key release !
e.xkey.keycode=27
e.xkey.state=16
Key release !
e.xkey.keycode=24
e.xkey.state=16

So, the key "b" is well detected and the command seems to be executed. In order to check that, I have changed the ~/.xbindkeysrc to:

"env > /tmp/xbtest.log"
   b

I start again:

$ xbindkeys -v
displayName = :0
rc file = /home/user/.xbindkeysrc
rc guile file = /home/user/.xbindkeysrc.scm
getting rc guile file /home/user/.xbindkeysrc.scm.
WARNING : /home/user/.xbindkeysrc.scm not found or reading not allowed.
1 keys in /home/user/.xbindkeysrc

min_keycode=8     max_keycode=255 (ie: know keycodes)
"env > /tmp/xbtest.log"
    b
starting loop...
Key press !
e.xkey.keycode=24
e.xkey.state=16
"env > /tmp/xbtest.log"
    b
got screen 0 for window 264
Start program with fork+exec call
Key release !
e.xkey.keycode=24
e.xkey.state=16

We can see that this time the output is shorted because the key "o" is not detected. So, now:

$ cat /tmp/xbtest.log
XDG_VTNR=7
KDE_MULTIHEAD=false
XDG_SESSION_ID=c1
DM_CONTROL=/var/run/xdmctl
SHELL=/bin/bash
TERM=xterm
XDM_MANAGED=method=classic
KONSOLE_DBUS_SERVICE=:1.34
GTK2_RC_FILES=/etc/gtk-2.0/gtkrc:/home/user/.gtkrc-2.0:/home/user/.kde4/share/config/gtkrc-2.0
KONSOLE_PROFILE_NAME=Terminal
GS_LIB=/home/user/.fonts
GTK_RC_FILES=/etc/gtk/gtkrc:/home/user/.gtkrc:/home/user/.kde4/share/config/gtkrc
WINDOWID=37748742
SHELL_SESSION_ID=e40298450a414000a0d0344051d20a7c
GTK_MODULES=canberra-gtk-module
KDE_FULL_SESSION=true
USER=user
SESSION_MANAGER=local/userarch:@/tmp/.ICE-unix/519,unix/userarch:/tmp/.ICE-unix/519
MOZ_PLUGIN_PATH=/usr/lib/mozilla/plugins
DESKTOP_SESSION=default
PATH=/home/user/.gem/ruby/2.0.0/bin:/home/user/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl
MAIL=/var/spool/mail/user
_=/usr/bin/env
QT_IM_MODULE=compose
PWD=/home/user
KONSOLE_DBUS_WINDOW=/Windows/1
EDITOR=vim
LANG=fr_FR.UTF-8
KDE_SESSION_UID=1000
KONSOLE_DBUS_SESSION=/Sessions/5
COLORFGBG=15;0
XDG_SEAT=seat0
HOME=/home/user
SHLVL=3
KDE_SESSION_VERSION=4
LANGUAGE=
XCURSOR_THEME=Oxygen_White
LOGNAME=user
DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-Y7rDDAnc7H,guid=929aa65abfe44e2c6f9a20a654d0c5c7
XDG_DATA_DIRS=/usr/share:/usr/share:/usr/local/share
WINDOWPATH=7
PROFILEHOME=
DISPLAY=:0.0
XDG_RUNTIME_DIR=/run/user/1000
QT_PLUGIN_PATH=/home/user/.kde4/lib/kde4/plugins/:/usr/lib/kde4/plugins/
XDG_CURRENT_DESKTOP=KDE

The command is perfectly run. So, what's wrong ? Why

"xdotool key o"
   b

does not work ? It does not work like before.

I have also tried xvkbd, even with full path (/usr/bin/xdotool, /usr/bin/xvkbd), nothing works.

Any suggestions ?

Thanks.

Last edited by quasar (2015-02-07 00:15:49)

Offline

#2 2015-02-06 11:45:20

Procyon
Member
Registered: 2008-05-07
Posts: 1,819

Re: [solved] What's wrong with xbindkeys ?

I had a similar issue, and I solved it with getwindowfocus:

"xdotool getwindowfocus key o"
        b

Offline

#3 2015-02-07 00:15:19

quasar
Member
Registered: 2014-01-18
Posts: 3

Re: [solved] What's wrong with xbindkeys ?

It works :-) Thank you ^^

But it was maybe a too simple case. This one does not work:

"xdotool getwindowfocus key ctrl+o"
    k

After a lot of testing, xbindkeys works fine, xdotool and xvkbd work fine too. I have tried that

"xdotool getwindowfocus key --clearmodifiers ctrl+o"
    k

without success.

But since

"sleep 2 && xdotool getwindowfocus key --clearmodifiers ctrl+o"

works fine in the console, I have tried:

"sleep 2 && xdotool getwindowfocus key --clearmodifiers ctrl+o"
    k

and it worked fine. The difference is, when xdotool is running, thanks to sleep, I have no keys pressed.

To be clear, the problem seems to come from the keys pressed (hardware) during xdotool sends key (software). But since all software haven't changed (xbindkeys, xdotool, xvkbd), and since kde has been updated to 5.6 during the pacman update, I suspect it comes from KDE.

So, I have tested under a software under GTK (Firefox, inside KDE, LibreOffice, Inkscape), and miracle, everything works fine.

I have then tested other KDE software, like KColourPaint, KDevelop, Konqueror, and it worked fine. So, it's a bug related to Kate and KWrite (KatePart?), I will just drop these software until they are fixed, btw, I have already seen another bug in Kate, KDE 5.6 has broken a lot of things :-(

Offline

Board footer

Powered by FluxBB