0

So, I've been using Elementary OS for a long time and one day I decided to install Gnome DE for variety. I started to customizing it for myself and everything was ok, until I got to xbindkeys. I'm using this program in my Pantheon DE (default DE for Elementary OS) for mapping mouse arrows as desktop switchers - it's very comfortable.

So in Gnome (Xorg) it works at half. In the US keyboard layout everything is good, it works very well. But when I switch to the Russian keyboard layout it just stops working. The daemon is still working, but nothing happens. I decided to run xbindkeys -v to get more information. I realized that e.xbutton.button is the same in all layouts, but e.xbutton.state is strange in the Russian layout - 8208. I found this post, got the patch from it, got the xbindkeys source by typing: git clone http://git.savannah.gnu.org/cgit/xbindkeys.git. Git didn't want to apply the patch by git apply -v xbindkeys_patch.patch – it says it can't find the wanted line. I opened the file which should be edited, and realized that it already has this fixed. Very interesting! I built it and installed it as described in the 'INSTALL' file:

$ ./configure
$ make
$ sudo make install

Now the following happened: xbindkeys now received mouse button in Russian layout and switches desktops, but... it takes a second or 1.5 seconds. On the US layout everything works immediately like before.

I decided to dig deeper. Using the best debugging principles (printf-debuging) I found a problem in the source code. This program uses Xlib API and it calls the XNextEvent() function, which takes this extreme amount of time on the Russian layout.

So it happens only in Gnome session. And I don't know what to do next. I would appreciate any help.

4
  • If this issue is Gnome-specific, would you like to report it to the Gnome developers, so they could fix it? Or (if you believe it to be elementary OS-specific) to elementary OS devs?
    – a-tokarev
    Commented Aug 1, 2019 at 11:37
  • Yeah, soon I'll try this program on another distro with Gnome and understand is it Elemetary Os-specific or Gnome-specific. But I already found this: state of pressed button in Xlib API means modifier-buttons pressed with that key. So, I can conclude, that Gnome-session switch languages in another way than Pantheon. Also I found that the language, which is highest in preferences, is the most workable for xbindkeys (and other programs like this). So, if I russian language is higher than english, it works immediately on russian layout, but with timeout on english. Commented Aug 2, 2019 at 7:23
  • Really interesting finding!
    – a-tokarev
    Commented Aug 2, 2019 at 7:39
  • Ok, I tryed xbindkeys in Ubuntu 18.04 live, and it works the same. I started thinking, that it's a Gnome problem. But then I got a XNextEvent example and modified it to print button state, and it works immediately on every layout. So, the problem is in the xbindkeys, that slow down the XNextEvent() function on another layout in Gnome. I don't know how did author do that. Some preference setted it program slow it down. Now I need Xlib-programer advice, omg. Commented Aug 4, 2019 at 13:46

1 Answer 1

0

Ok, I've found a way to fix this. I created simple script in python, that changes layouts order in preferences when the layout changing event was received. And it works!

My sript: https://github.com/Arjentix/Gnome-Layout-Fix

Hope it will be useful for someone, who will have the same problem.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.