executing scripts when pressing keyboard hotkeys
Hi!
I have a Dell Inspiron laptop on which I can not use the LCD brightness function keys. My question is more of a general inquiry as to how to use eg. those keys, and bind some scripts to them. The keys are recognized with xev(1), they are reported as XF86MonBrightnessUp and XF86MonBrightnessDown. At least under Xorg I could use these keys, if I could use some daemon which listens to these keypresses. I remember I used hotkeyd [1] before but it seems unmaintained. I'm not using any common desktop environment, so there isn't any configurator for these kind of things. On the other hand, it would be awesome if the solution would also work on the console. This would not only be useful for the brightness keys, but any other otherwise "unusable" hotkeys on the keyboard. Any advice would be appreciated, Thanks [1] - http://hotkeyd.sourceforge.net/ |
Recently I found an awesome tool that I think can help you a lot. It's name is xdotool. But anyway it depends on your X Server.
|
Odd, I always assumed those keys worked directly with the kernel, I've certainly never had to configure them on any system or with any distro.
Even if you're not using KDE or XFCE or one of those, most WMs will have some sort of config file to allow you to bind hotkeys to commands. ~/.fluxbox/keys with fluxbox, ~/.ratpoisonrc with ratpoison, and so on. Maybe you can use Xmodmap to do it directly through the X server so it will work with any DE or WM. You'd just have to tell it react to that keypress by changing the value for your backlight brightness, which I believe is in some file in /sys or /proc. Certainly used to be. If you want it to work with the console, you could probably use inputrc, assuming you're using bash or anything remotely similar, and bind the key to a command there, if it's being read by the console. That won't work with keys or combinations already commandeered by other things, like Alt-F1. On my system the brightness controls are Fn+arrow keys, you could probably bind Alt-arrows if you wanted, using inputrc. Of course that'll only work at the prompt, not in other cli programmes. Maybe something with loadkeys or udev. |
Quote:
Quote:
Quote:
Thanks for the insights and the tips! |
Quote:
|
All times are GMT -5. The time now is 06:58 AM. |