Bind certain keys to change screen brightness
Hi - I am using Ubuntu linux, and I want fn + up key and fn + down key to change the brightness instead on fn + F4 and fn + F5. I've tried looking for something in the Keyboard Shortcuts menu, but there is no command or key specified to do that. I could make a custom key shortcut, but I can't find the command to change the brightness. Is there a way to make another key do this?
My laptop is a Dell Inspiron 1545. |
Is there a file relating to your laptop in /usr/share/hotkey-setup/ ?
If so, you may be able to edit that to use the keys you want. This is the example for a samsung laptop. |
No, there's not... Any other ideas?
|
bump
|
bump
bump
|
Have you tried running the setkeycode commands illustrated in the linked page? There are similar commands on this Arch Linux Wiki page for a Samsung N150.
On a Samsung N150 running Slackware 13.1 Linux and Xfce desktop, I enabled brightness adjustment via Fn+Up and Fn+Dn by running the following commands from the boot scripts Code:
setkeycodes e008 225 # Fn+Up maps to brightnessup |
Quote:
Code:
Couldn't get a file descriptor referring to the console |
Quote:
Ideally you want someone answering who has got those keys working on the same laptop as yours, using the same distro but they haven't come along yet. Laptops/netbooks differ, distros differ (there's no /usr/share/hotkey-setup on my Slackware 13.1 system either) but some things work the same way (the distros are all Linux-based, manufacturers use the same chips) so it's worth trying things that have worked on dissimilar systems. |
Okay, so I entered the commands as root and it didn't give me any errors. However, the arrow keys still don't work for changing brightness. I've tried finding out the keycodes with xev, but it returns the same code whether I'm holding down fn or not. I also tried mapping it using System > Preferences > Keyboard Shortcuts, but it wouldn't recognize fn + up as any different from just up either. It seems like the keyboard only recognizes key combinations with functions that came with the computer, not fn as a separate key, like I thought. Is there any way to change this, or is it set in stone?
|
It may be that the keycodes generated by Fn+Up/Dn on a Dell Inspiron 1545 are not the same as on a Samsung N10 or N150. Unfortunately IDK how you can find out what they are. xev output for Fn+Up/Dn on my system doesn't make much sense either.
It would make sense for the keyboard not to output anything unless the Fn modifier is used with a key "that came with the computer", usually marked in blue (all the arrow keys are marked in blue on the N150). The Fn is a modifier key, as are like alt, ctrl, shift and super. I thought modifier keys alone did not generate keycodes but recently found that is wrong having been able to interactively set super alone (and super+e) as shortcut keys under Xfce. There is thus some hope for being able to do what you want but I don't know the crucial next step of how to find out the keycodes generated by experimental key and key combination use. You could start a new topic asking that question. |
Quote:
I'll just use the GUI to set the Control key instead, so ctrl + up and down to xbacklight -inc 10 and xbacklight -dec 10, respectively. |
All times are GMT -5. The time now is 03:45 PM. |