LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Laptop and Netbook
User Name
Password
Linux - Laptop and Netbook Having a problem installing or configuring Linux on your laptop? Need help running Linux on your netbook? This forum is for you. This forum is for any topics relating to Linux and either traditional laptops or netbooks (such as the Asus EEE PC, Everex CloudBook or MSI Wind).

Notices


Reply
  Search this Thread
Old 09-24-2003, 11:18 PM   #1
nef
Member
 
Registered: Dec 2002
Location: Mexico
Distribution: ArchLinux 0.7, Slackware 10.1
Posts: 61

Rep: Reputation: 15
external volume buttons


i have a compaq x1000 series and it has three buttons (up, down and mute) that enable you to control the volume of the speakers from the outside of the laptop.
is there a way to make this buttons work under linux???
 
Old 09-25-2003, 06:20 PM   #2
Brian1
LQ Guru
 
Registered: Jan 2003
Location: Seymour, Indiana
Distribution: Distribution: RHEL 5 with Pieces of this and that. Kernel 2.6.23.1, KDE 3.5.8 and KDE 4.0 beta, Plu
Posts: 5,700

Rep: Reputation: 65
Check out this info here. It will be a start to see if it can be seen.
http://sdb.suselinux.hu/en/sdb/html/extrakeys.html

Good luck
Brian1
 
Old 09-26-2003, 01:02 PM   #3
nef
Member
 
Registered: Dec 2002
Location: Mexico
Distribution: ArchLinux 0.7, Slackware 10.1
Posts: 61

Original Poster
Rep: Reputation: 15
that site was very helpful
anyway, i used xev to find out the keycodes of my volume buttons, now i know i have to change the xmodmap file, but before, i have to assign an action to each key.
how can i do so???
 
Old 09-27-2003, 12:06 PM   #4
Brian1
LQ Guru
 
Registered: Jan 2003
Location: Seymour, Indiana
Distribution: Distribution: RHEL 5 with Pieces of this and that. Kernel 2.6.23.1, KDE 3.5.8 and KDE 4.0 beta, Plu
Posts: 5,700

Rep: Reputation: 65
Under KDE3 mapping Special keys, Hotkeys, Multimedia Keys

You really gave me a challenge. But I finially got what I think will work for you. Thanks to these web sites:
http://sdb.suselinux.hu/en/sdb/html/extrakeys.html
http://www.linuxgazette.com/issue67/evans.html
http://www.mail-archive.com/expert@l.../msg48067.html
https://me.in-berlin.de/~peter/gnu-l...tastatur.shtml
http://ypwong.org/hotkeys/
http://www.ignavus.net/software.html


Part 1 Mapping Keys to Scripts. (I have this working fine)
1. Need to create 2 executable scripts to. One for volume up and one for volume down. Not sure how to create a mute option.

Contents for volume up named ' volumeup '
#!/bin/sh
aumix -v +5 -S

Contents of volume down named ' volumeudn '
#!/bin/sh
aumix -v -5 -S

Save both files under my /opt directory. Make sure scripts have full read, write , & executable permissions for all users.

2. Now create a file under ~/.kde/share/config called ' khotkeysrc ' ' ~ ' character reprosents your home directory if you did not know. Typeing ' cd ~ ' will take to your home directory of the user you are login as.

Contents of ' ~/.kde/share/config/khotkeysrc '
[Main]
Num_Sections=2
Version=1

[Section1]
MenuEntry=false
Name=volumeudn
Run=/opt/volumeudn
Shortcut=F11

[Section2]
MenuEntry=false
Name=volumeup
Run=/opt/volumeup
Shortcut=F12

Save file.

3. execute this command in ~/kde/share/config directory
' dcop khotkeys khotkeys reread_configuration '

4. Start playing some music and try your F11 and F12 keys. If volume goes up and down (note don't press the keys real fast, pause a 1/2 second between keypresses of F11 or F12).


Part 2 Mapping Special key to Key ( This I have not done. )
5. Now to map your volume buttons to F11 & F12. I have not done this part but following info from the earlier post on X. Make a backup copy of your /etc/X11/Xmodmap. Now edit /etc/X11/Xmodmap and setup like the following. Replace the ' ** ' with the keycode you recieved from ' xev ' program.


! /etc/X11/Xmodmap

! mapping volume keys
keycode ** = F11
keycode ** = F12


6. Save and exit

7. Execute the following command ' xmodmap /etc/X11/Xmodmap '

Let me know how this works.
Have fun
Brian1
 
Old 09-27-2003, 12:10 PM   #5
Thymox
Senior Member
 
Registered: Apr 2001
Location: Plymouth, England.
Distribution: Mostly Debian based systems
Posts: 4,368

Rep: Reputation: 64
Also, there is XBindKeys. Very nice - but be sure to also download XBindKeysConfig so you get a nice GUI configuration editor.
 
Old 09-28-2003, 04:05 PM   #6
nef
Member
 
Registered: Dec 2002
Location: Mexico
Distribution: ArchLinux 0.7, Slackware 10.1
Posts: 61

Original Poster
Rep: Reputation: 15

it works!!!!!!

i used xbindkeys (with xbindkeysconfig). it was very easy, this program does everything for you. it gets the keycode for you and then you just assign the command you want it to execute (in this case aumix, thanx brian).
that was so easy, thanx again.

do you know what command can i use to mute/unmute??

Last edited by nef; 09-28-2003 at 04:14 PM.
 
Old 09-28-2003, 06:29 PM   #7
Brian1
LQ Guru
 
Registered: Jan 2003
Location: Seymour, Indiana
Distribution: Distribution: RHEL 5 with Pieces of this and that. Kernel 2.6.23.1, KDE 3.5.8 and KDE 4.0 beta, Plu
Posts: 5,700

Rep: Reputation: 65
Revised 3-18-2007

I assume you only have a single button for mute. I made 3 scripts to get this to work very simply. You map your key to /storage1/Multimedia/volumekeys.

edit: Updated the scripts so volume setting is saved then is restored to previous setting.

Contents of /storage1/Multimedia/volumekeys/volumemute2
Code:
#!/bin/bash
# The script ready to mute the Master channel
/usr/bin/amixer -c0 sset Master mute
cp --reply=yes /storage1/Multimedia/volumekeys/volumemute1 /storage1/Multimedia/volumekeys/volumemute
Contents of /storage1/Multimedia/volumekeys/volumemute1
Code:
#!/bin/bash
# The script to ready to unmute the Master channel
/usr/bin/amixer -c0 sset Master unmute
cp --reply=yes /storage1/Multimedia/volumekeys/volumemute2 /storage1/Multimedia/volumekeys/volumemute
Contents of /storage1/Multimedia/volumekeys/volumemute
Code:
#!/bin/bash
# The script ready to mute the Master channel
/usr/bin/amixer -c0 sset Master mute
cp --reply=yes /storage1/Multimedia/volumekeys/volumemute1 /storage1/Multimedia/volumekeys/volumemute
I would copy over volumemute2 contents to volumemute script for the first time. I also add the command ' cp --reply=yes /storage1/Multimedia/volumekeys/volumemute2 /storage1/Multimedia/volumekeys/volumemute ' to /etc/rc.local file so it is set to go from a reboot.

edit:

These scripts just keep rewriting volumemute to be ready for the next time you hit the mute key. I haven't restarted my Linux box for over 123 days and have not seen whether there is a default volume would return after reboot.

This has been a fun project for me. I ended up adding this to my linux box and linux notebook using the F10 for mute and unmute, F11 volume down, and F12 for volume up. I am working on a simply website with helpful tips and I will add my idea for hotkey.

edit:
I added the volumemute script to my KDE startmenu. they clicking on the hotkey button at the lower right corner I hit the F10 key to map it to F10 key.

Can you provide me with the steps you did using xbinkeys ( from downloading to installing, to configuration to all the way to the key? I will add that to my site as well.

Last edited by Brian1; 03-18-2007 at 08:52 AM.
 
Old 09-28-2003, 07:09 PM   #8
nef
Member
 
Registered: Dec 2002
Location: Mexico
Distribution: ArchLinux 0.7, Slackware 10.1
Posts: 61

Original Poster
Rep: Reputation: 15
well, you can download xbindkeys from
http://hocwp.free.fr/xbindkeys/xbindkeys.html
and xbindkeys config from
http://www.netchampagne.com/xbindkeys_config/

after downloading, installing is the same as always

tar xzvf xbindkeys.....
cd xbindkeys
./configure
make
make install

and the same for xbindkeys config

then, you run xbindkeys config
click on add
on name you write what this key is going to do ex. volumeup
click on get key and press the key you want to configure (in my case the volume up key)
in the field "action" you write the command you want it to execute ex. aumix -v +5 -S
to finish you click save/save & apply & exit

the only problem is that when i reboot it wont work anymore, i have to rerun xbindkeys to be able of using the keys, is there a way to make this work every time i boot???

Last edited by nef; 09-28-2003 at 07:18 PM.
 
Old 09-28-2003, 07:13 PM   #9
Thymox
Senior Member
 
Registered: Apr 2001
Location: Plymouth, England.
Distribution: Mostly Debian based systems
Posts: 4,368

Rep: Reputation: 64
Cool! Thanks Brian1! I've been thinking about how to do this for a while... never occured to me to do something like that!
 
Old 09-28-2003, 08:33 PM   #10
Brian1
LQ Guru
 
Registered: Jan 2003
Location: Seymour, Indiana
Distribution: Distribution: RHEL 5 with Pieces of this and that. Kernel 2.6.23.1, KDE 3.5.8 and KDE 4.0 beta, Plu
Posts: 5,700

Rep: Reputation: 65
On the Documention of XBinkeys here:
http://hocwp.free.fr/xbindkeys/xbind...#configuration

It says to do this:
You can now use xbindkeys by typing : xbindkeys &

or by loading it automatically when X starts up by adding the preceeding line to the file $HOME/.xsession.

If .xsession is not there I believe you can just create one. If you try it let me know.

I would problaby add xbindkeys to /etc/rc.local

Nef thanks for the procedure I will add soon to my webpage. If anything above works let me know what you did it. XBindkeys Gui looks pretty cool.
Brian1
 
Old 09-29-2003, 06:03 PM   #11
nef
Member
 
Registered: Dec 2002
Location: Mexico
Distribution: ArchLinux 0.7, Slackware 10.1
Posts: 61

Original Poster
Rep: Reputation: 15
well, i tried both
added xbindkeys to the end of /etc/rc.local and didnt work
created .xsession, but didnt work either

i can execute any of the two files and get xbindkeys working, but it's not working automatically when i boot
ideas......
 
Old 09-29-2003, 07:44 PM   #12
Brian1
LQ Guru
 
Registered: Jan 2003
Location: Seymour, Indiana
Distribution: Distribution: RHEL 5 with Pieces of this and that. Kernel 2.6.23.1, KDE 3.5.8 and KDE 4.0 beta, Plu
Posts: 5,700

Rep: Reputation: 65
Sorry did not see it as an X app. Can't be put in /etc/rc.local. Use this for non X apps.
In your ~/.xsession did you include the ' & ' after xbindkeys?
I think .xsession needs to be an executable? Requires #!/bin/sh at the top. I'm not about sure about that, does anyone here know?

According to /etc/X11/xdm/Xsession script it should look at ~/.xsession then /etc/X11/xinit/Xclients.


Another option. Look this over related to Xclients is:
http://www.linuxquestions.org/questi...t+program+in+X
add ' exec xbindkeys & ' to the section shown in the example above.

Make sure you add ' & ' after the command. This makes the program get a new pid so it is not attached to what started it. Same as in a terminal screen ex. ' gkrellm & ' and now you can close the terminal screen and tha app still runs. Does not work with some apps.


Another bit of info off the wall.
* Start app in xterminal like xmms & and type exit (don't hit the X to close window) and the program still runs.
* Now imagine that you forgot to use the "&" symbol to put the program into the background. There is still hope. You can type control-z and the process will be suspended. The process still exists but is idling. To resume the process in the background type the bg command (short for background).

Let me know this goes for you. When done do a complete procedure from the beginning for me if you don't mind.

Good luck and have fun. Don't forget to search the WWW the Google way. http://www.google.com/linux
Brian1

Last edited by Brian1; 09-29-2003 at 07:46 PM.
 
Old 09-30-2003, 08:29 PM   #13
nef
Member
 
Registered: Dec 2002
Location: Mexico
Distribution: ArchLinux 0.7, Slackware 10.1
Posts: 61

Original Poster
Rep: Reputation: 15
that was some useful information
well, i actually thought xbindkeys (the non-gui version) wasn't an x app.

(maybe all these settings are distro dependant, remember im using mdk 9.1)
~/.xsession does not exist (at least not in my system)
/etc/X11/xdm/Xsession is a script that runs /etc/X11/Xsession; i tried putting the command xbindkeys here and didnt work

now, /etc/X11/Xsession gives us a lot information. i tried putting xbindkeys here and did not work either.

if you read a little on Xsession, you'll see it runs the script /etc/X11/xinit/fixkeyboard which has a lot to do with Xmodmap, etc.
i put it there and it worked!!!

so the complete procedure might look a little bit like this, even though, im very sure this wont work for everyone.

su to root
open (with vi or pico or whatever you like) /etc/X11/xinit/fixkeyboard
at the end of the script add exec xbindkeys &
save the script
and youre ready to go

thanx again brian for all your answers
 
Old 10-01-2003, 05:07 PM   #14
Brian1
LQ Guru
 
Registered: Jan 2003
Location: Seymour, Indiana
Distribution: Distribution: RHEL 5 with Pieces of this and that. Kernel 2.6.23.1, KDE 3.5.8 and KDE 4.0 beta, Plu
Posts: 5,700

Rep: Reputation: 65
Thanks for the info. Redhat 9 does not have the fixkeyboard script. If I ever need to setup Xbindkeys like that I will give Xclients script a try. I went ahead and added the mute option to my F10 key. Don't know how I can do without now.

Great little project. Enjoy your Linux setup more than ever before.
Brian1
 
Old 10-14-2003, 01:35 PM   #15
landenm
LQ Newbie
 
Registered: Aug 2003
Location: Springfield
Distribution: Suse 8.2
Posts: 5

Rep: Reputation: 0
Xclients worked

I am using RH9 and I edited the Xclients script. From what I could tell, that script finds what desktop to asscoiate with the logon ID. So putting the command

exec xbindkeys &

at the beginning of the file worked like a charm
 
  


Reply



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
volume and access buttons on ze4315 dracolich Linux - Laptop and Netbook 15 07-26-2008 12:19 AM
Volume buttons kill keyboard.. CHambeRFienD Ubuntu 0 10-16-2005 12:41 AM
mute/volume buttons to work? microsoft/linux Linux - Laptop and Netbook 7 08-20-2005 02:35 PM
volume buttons on my laptop emg SUSE / openSUSE 1 06-24-2005 10:34 PM
Volume Buttons on an HP-ze4805US efanning Linux - Laptop and Netbook 3 09-08-2004 01:51 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Laptop and Netbook

All times are GMT -5. The time now is 06:33 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration