1

I wrote two custom scripts to brighten/dim my screen and want to bind them to my F9 and F10 keys. I put them into /opt/bin and used sudo chown root:root script and sudo chmod 755 script on both and they work when called from the terminal.

When I now try to run xbindkeys -v, with these lines added to ~/.xbindkeysrc

"/opt/bin/dim_screen.sh"
    Control + c:75

"/opt/bin/brighten_screen.sh"
    Control + c:76

it gives me this error message:

displayName = :0.0
rc file = /home/pi/.xbindkeysrc
rc guile file = /home/pi/.xbindkeysrc.scm
getting rc guile file /home/pi/.xbindkeysrc.scm.
WARNING : /home/pi/.xbindkeysrc.scm not found or reading not allowed.
2 keys in /home/pi/.xbindkeysrc

min_keycode=8     max_keycode=255 (ie: know keycodes)
"/opt/bin/dim_screen.sh"
    m:0x4 + c:75
    Control + F9
"/opt/bin/brighten_screen.sh"
    m:0x4 + c:76
X Error of failed request:  BadAccess (attempt to access private resource denied)
  Major opcode of failed request:  33 (X_GrabKey)
  Serial number of failed request:  17
  Current serial number in output stream:  21

At first I thought its about the file permissions of the scripts, thus I added

    ALL ALL= NOPASSWD: /opt/bin/brighten_screen.sh
    ALL ALL= NOPASSWD: /opt/bin/dim_screen.sh

to my /etc/sudoers. But the error persisted, so I read it again and now after reading about xgrabkeys I think the key signals are already in use by some other program when xbindkeys wants to read them, so that it can't access them. It also won't work when I don't use Function Keys.

Because it may well be that F9 and F10 are reserved for internal purposes I changed the xmodmap mapping of F9 to F13 and of F10 to F14

I could temporarily make it work, by following the instructions by Vincent Yu on the Question "Using xbindkeys to bind the meta key (a.k.a. super key / Windows key) to left click and allow drag and drop" (I noticed what he said about the changes not being persistent through sessions) but now after reboot it gives me the same error again (with F9substituted by F13), even though i ran xmodmap -e 'keycode 75 = F13' and xmodmap -e 'keycode 76 = F14' respectively and changed my ~/.Xmodmap

I don't know how to handle that or find out what blocks xbindkeys from using the keys. Google didn't give me helpful results and a glance over the posts on unix.SE (with exception of the aforementioned one) didn't help, either.

I use the Raspbian Jesse core with lxde if thats relevant.

0

I had similar problem, google lead me to https://askubuntu.com/questions/499926/why-do-these-xte-commands-work-in-terminal-but-not-when-bound-with-xbindkeys, which basically says add the xbindkeys-specific modifier release to the key binding so that they script fires on "keyup" in javascript parlance. Doing that fixes the issue for me.

So for your case the following should work:

"/opt/bin/dim_screen.sh"
    Control + c:75 + release

"/opt/bin/brighten_screen.sh"
    Control + c:76 + release
2
  • thanks alot, that sounds plausible. somehow it already fixed itself for me, but i will try to recreate the situation and use your answer ... – Fynn Mar 2 '17 at 14:59
  • when it works i will accept. and thanks again for the tip, i wouldnt have thought about it – Fynn Mar 2 '17 at 15:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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