LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices

Reply
 
Search this Thread
Old 10-21-2012, 01:18 PM   #1
danielldaniell
Member
 
Registered: Apr 2009
Location: Hungary
Distribution: Slackware, OpenBSD
Posts: 42

Rep: Reputation: 15
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/
 
Old 10-22-2012, 08:12 AM   #2
shahinism
LQ Newbie
 
Registered: Aug 2012
Distribution: Slackware
Posts: 15

Rep: Reputation: Disabled
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.
 
1 members found this post helpful.
Old 10-22-2012, 09:21 AM   #3
Stephen Morgan
Member
 
Registered: Feb 2011
Location: England
Distribution: Slackware
Posts: 147

Rep: Reputation: 15
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.
 
1 members found this post helpful.
Old 10-22-2012, 03:01 PM   #4
danielldaniell
Member
 
Registered: Apr 2009
Location: Hungary
Distribution: Slackware, OpenBSD
Posts: 42

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by Stephen Morgan View Post
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.
With some models they actually work. The brightness keys are working during the BIOS boot and even in LILO. After the kernel boots, they just produce '@' characters.

Quote:
Originally Posted by Stephen Morgan View Post
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.
Okay, I'll try to look into it deeper

Quote:
Originally Posted by Stephen Morgan View Post
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.
Well, on a second thought, it won't be too much of a trouble to use the scripts directly in the command line; that is at least close to a full solution.


Thanks for the insights and the tips!
 
Old 10-22-2012, 03:03 PM   #5
danielldaniell
Member
 
Registered: Apr 2009
Location: Hungary
Distribution: Slackware, OpenBSD
Posts: 42

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by shahinism View Post
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.
Thanks for the pointer. I'm afraid it doesn't quite do what I need here, but nevertheless it is a very useful tool. I could definitely use it in the future for other purposes.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Hotkeys on Dell Keyboard swulff Linux - Hardware 1 07-07-2007 10:54 PM
Programming hotkeys on Wireless Keyboard VRV Linux - Software 2 08-04-2006 08:20 AM
Microsoft Internet Keyboard: Can I use the hotkeys? JBailey742 Linux - Hardware 4 08-01-2006 01:22 AM
Keyboard Hotkeys manicman Linux - Newbie 3 02-03-2006 09:01 AM
Opening a terminal with keyboard hotkeys? Cinematography Linux - Software 4 06-04-2005 03:47 PM


All times are GMT -5. The time now is 07:38 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration