The time now is Thu 25 Feb 2021, 09:12
All times are UTC - 4 |
Page 1 of 2 [21 Posts] |
Goto page: 1, 2 Next |
Author |
Message |
noryb009
Joined: 20 Mar 2010 Posts: 636
|
Posted: Thu 24 Jun 2010, 17:51 Post subject:
How to set keyboard shortcuts? Subject description: I have Calculator, Log Off, and some other buttons on my keyboard. |
|
I have Calculator, Log Off, media buttons (play, back, next, mute, ect.) and some other buttons on my keyboard that I want to use in puppy 501. Windows automatically works with the buttons. Is there any way to use these in puppy?
|
Back to top
|
|
 |
npierce
Joined: 28 Dec 2009 Posts: 858
|
Posted: Sat 26 Jun 2010, 10:56 Post subject:
|
|
First we need to see if the X server can see these keys. Use xev to do that. If you don't have xev on your Puppy, it can be downloaded here:
http://www.murga-linux.com/puppy/viewtopic.php?mode=attach&id=12635
Open the file with pupzip, extract xev to /usr/local/bin/ and execute this command:
A window named "Event Tester" will appear. Press and release a letter key to see if xev is working. You should see something like this in your rxvt window:
Code: | KeyPress event, serial 29, synthetic NO, window 0x1400001,
root 0x55, subw 0x0, time 1957549319, (504,387), root:(732,634),
state 0x0, keycode 38 (keysym 0x61, a), same_screen YES,
XLookupString gives 1 bytes: (61) "a"
XmbLookupString gives 1 bytes: (61) "a"
XFilterEvent returns: False
KeyRelease event, serial 29, synthetic NO, window 0x1400001,
root 0x55, subw 0x0, time 1957549475, (504,387), root:(732,634),
state 0x0, keycode 38 (keysym 0x61, a), same_screen YES,
XLookupString gives 1 bytes: (61) "a"
XFilterEvent returns: False |
If you don't see something similar, click in the "Event Tester" window and try again.
Once you have it working, try each of your special buttons. If nothing happens then I can't help you. But if they cause KeyPress and KeyRelease events, report the keycodes and keysyms, and we can probably figure out a way to make them useful.
To exit out of xev close the "Event Tester" window, or click in the rxvt window and press ctrl+c.
|
Back to top
|
|
 |
noryb009
Joined: 20 Mar 2010 Posts: 636
|
Posted: Sat 26 Jun 2010, 14:24 Post subject:
|
|
OK, most of the keys work. These include:
My Documents
Mute
Play/Pause
Stop
Volume Up
Volume Down
Skip (used in media players)
Back (used in media players)
Media
Mail
Web
Calculator
Sleep
I mostly want to use the buttons between Mute and Back.
|
Back to top
|
|
 |
npierce
Joined: 28 Dec 2009 Posts: 858
|
Posted: Sat 26 Jun 2010, 19:18 Post subject:
|
|
First, I must warn you that making the buttons useful is one thing, and making them do exactly what you want is another. But let's see what we can do.
I don't have buttons like yours, but I do have keys that I can use with the Fn key to do things like mute the sound. Some, like the screen brightness keys, seem to be controlled by the BIOS, and they've always worked. I'd never tried to get the others to do anything. However, your question has inspired me!
So let's start off with Mute, Volume Up, and Volume Down.
The following works for me using JWM on Puppy 4.3.1. If you are using something else, we may need to make some adjustments.
Make a backup of /root/.jwm/jwmrc-personal then edit it to add the following lines to the list of other Key lines:
Code: | <Key keycode="160">exec:amixer sset Master 0</Key>
<Key keycode="176">exec:amixer sset Master 1+,1+</Key>
<Key keycode="174">exec:amixer sset Master 1-,1-</Key> |
You will need to replace my keycodes with the keycodes you obtained from xev.
Restart JWM (Menu -> Shutdown -> Restart JWM) and try out those three buttons.
Now I'm going to go experiment with some of the other keys.
|
Back to top
|
|
 |
noryb009
Joined: 20 Mar 2010 Posts: 636
|
Posted: Sat 26 Jun 2010, 21:56 Post subject:
|
|
I'm using puppy 501, which uses zmixer (I think), which doesn't support those commands,
|
Back to top
|
|
 |
npierce
Joined: 28 Dec 2009 Posts: 858
|
Posted: Sat 26 Jun 2010, 22:52 Post subject:
|
|
Correct, zmixer doesn't support those commands.
I have zmixer. But I also have amixer.
If you open a terminal window and run
and it spits out a list of simple mixer controls, then you have it too. If you don't have it, do you have alsamixer?
|
Back to top
|
|
 |
noryb009
Joined: 20 Mar 2010 Posts: 636
|
Posted: Sun 27 Jun 2010, 12:49 Post subject:
|
|
I guess I do have amixer.
|
Back to top
|
|
 |
mdev
Joined: 17 May 2010 Posts: 19 Location: Berlin
|
Posted: Sun 27 Jun 2010, 13:00 Post subject:
|
|
There are special keysyms for these. For example, I have the following in my ~/.Xmodmap
Code: |
keycode 121 = XF86AudioMute NoSymbol XF86AudioMute NoSymbol XF86AudioMute
keycode 122 = XF86AudioLowerVolume NoSymbol XF86AudioLowerVolume NoSymbol XF86AudioLowerVolume
keycode 123 = XF86AudioRaiseVolume NoSymbol XF86AudioRaiseVolume NoSymbol XF86AudioRaiseVolume
keycode 208 = XF86AudioPlay NoSymbol XF86AudioPlay NoSymbol XF86AudioPlay
keycode 209 = XF86AudioPause NoSymbol XF86AudioPause NoSymbol XF86AudioPause
keycode 232 = XF86MonBrightnessDown NoSymbol XF86MonBrightnessDown NoSymbol XF86MonBrightnessDown
keycode 233 = XF86MonBrightnessUp NoSymbol XF86MonBrightnessUp NoSymbol XF86MonBrightnessUp
|
After making changes to the file, run:
|
Back to top
|
|
 |
npierce
Joined: 28 Dec 2009 Posts: 858
|
Posted: Mon 28 Jun 2010, 16:10 Post subject:
|
|
mdev,
Thanks for the tip about the special keysyms. Your way is certainly a better way to do this, since any application that recognizes these keysyms will then work without the need to plug in the keycodes, and once those applications are configured they will work with any keyboard that has those buttons, as long as the symbols are mapped to the keys.
My keyboard is different from yours, so I used the following for my .Xmodmap:
Code: | keycode 160 = XF86AudioMute
keycode 174 = XF86AudioLowerVolume
keycode 176 = XF86AudioRaiseVolume
keycode 162 = XF86AudioPlay XF86AudioPause
keycode 164 = XF86AudioStop
keycode 144 = XF86AudioPrev
keycode 153 = XF86AudioNext |
noryb009,
You can add the above lines to your /root/.Xmodmap file. (If that file doesn't yet exist, simply create a new one.) If the keycodes that you got from xev are different from what I have above, you will need to adjust accordingly.
Then, as mdev said, run:
noryb009 wrote: | I guess I do have amixer |
Were you able to edit /root/.jwm/jwmrc-personal and get the mute and volume buttons working? If you are new to editing configuration files and want some help, let us know.
The following lines can be added to your /root/.jwm/jwmrc-personal to support the keys that you listed in an earlier post. The audio player controls are configured here to work with aqualung.
Code: | <Key key="XF86AudioMute">exec:amixer sset Master 0</Key>
<Key key="XF86AudioRaiseVolume">exec:amixer sset Master 1+,1+</Key>
<Key key="XF86AudioLowerVolume">exec:amixer sset Master 1-,1-</Key>
<Key key="XF86AudioPlay">exec:aqualung -N 0 -L</Key>
<Key mask="S" key="XF86AudioPause">exec:aqualung -N 0 -U</Key>
<Key key="XF86AudioStop">exec:aqualung -N 0 -T</Key>
<Key key="XF86AudioPrev">exec:aqualung -N 0 -B</Key>
<Key key="XF86AudioNext">exec:aqualung -N 0 -F</Key>
<Key key="XF86Documents">exec:rox ~/my-documents</Key>
<Key key="XF86AudioMedia">exec:xmessage "Media button was pressed."</Key>
<Key key="XF86Mail">exec:defaultemail</Key>
<Key key="XF86WWW">exec:defaultbrowser</Key>
<Key key="XF86Calculator">exec:calcoo</Key>
<Key key="XF86Sleep">exec:xmessage "Sleep button was pressed."</Key> |
I don't know what you want your Media button to do, so it is configured here to just bring up a test message. If you know the command that you want it to run, you can just put it where it now says xmessage '"Media button was pressed."' I did the same for your Sleep button, since I don't know what command Puppy 5.0 uses for that, or if your PC supports it properly.
If you cannot get the amixer working, you could replace the mute and volume lines with these:
Code: | <Key key="XF86AudioMute">exec:aqualung -V m</Key>
<Key key="XF86AudioRaiseVolume">exec:aqualung -V +3</Key>
<Key key="XF86AudioLowerVolume">exec:aqualung -V -3</Key> |
But using these lines will affect mute and volume for aqualung only, not other applications.
I've tested all this in Puppy 4.3.1. Please let us know if you need to make adjustments for Puppy 5.0, or have other questions. (And when you get it working, we'd like to hear that too!)
Good luck.
|
Back to top
|
|
 |
noryb009
Joined: 20 Mar 2010 Posts: 636
|
Posted: Fri 02 Jul 2010, 12:27 Post subject:
|
|
I can't get any of the buttons to work.
|
Back to top
|
|
 |
npierce
Joined: 28 Dec 2009 Posts: 858
|
Posted: Fri 30 Jul 2010, 12:52 Post subject:
|
|
Sorry for the delay in responding. I've been away from my computer this month.
Did you remember to run xmodmap after editing /root/.Xmodmap and restart JWM after editing /root/.jwm/jwmrc-personal ?
Did you get any error messages when you ran xmodmap or restarted JWM?
What keycodes and keysyms did you get when you ran xev?
If you post the contents of your /root/.Xmodmap and /root/.jwm/jwmrc-personal files, perhaps we can figure out what has gone wrong.
|
Back to top
|
|
 |
noryb009
Joined: 20 Mar 2010 Posts: 636
|
Posted: Sat 31 Jul 2010, 18:30 Post subject:
|
|
Quote: | I don't know what you want your Media button to do |
It is supposed to open the a media player (like aqualung)
Anyways, I've read over the whole topic again. In my jwmrc-personal, am I supposed to have a, b, c or d?
a) <Key key="XF86AudioMute">exec:amixer sset Master 0</Key>
b) <Key key="XF86*insert key code here*">exec:amixer sset Master 0</Key>
c) <Key key="XF*insert key code here*">exec:amixer sset Master 0</Key>
d) <Key key="*insert key code here*">exec:amixer sset Master 0</Key>
|
Back to top
|
|
 |
npierce
Joined: 28 Dec 2009 Posts: 858
|
Posted: Sun 01 Aug 2010, 10:04 Post subject:
|
|
noryb009 wrote: | . . . am I supposed to have a, b, c or d? |
a
And you will need a line like this in /root/.Xmodmap
Code: | keycode 160 = XF86AudioMute |
Of course, your keyboard may want a number other than 160. Use the keycode value that you got from xev.
noryb009 wrote: | Quote: | I don't know what you want your Media button to do |
It is supposed to open the a media player (like aqualung) |
Okay, so you would use this line in jwmrc-personal
Code: | <Key key="XF86AudioMedia">exec:aqualung</Key> |
and a line like this in /root/.Xmodmap
Code: | keycode 237 = XF86AudioMedia |
Again, your keyboard may not use 237. Use the keycode value that you got from xev.
|
Back to top
|
|
 |
DaveS

Joined: 09 Oct 2008 Posts: 3726 Location: UK
|
Posted: Sun 01 Aug 2010, 16:14 Post subject:
|
|
npierce wrote: |
Code: | <Key keycode="160">exec:amixer sset Master 0</Key>
<Key keycode="176">exec:amixer sset Master 1+,1+</Key>
<Key keycode="174">exec:amixer sset Master 1-,1-</Key> |
|
Just a small thing: in line 1 above, if you use
Code: | <Key keycode="160">exec:amixer sset Master toggle</Key> |
Then the key will toggle mute on/off/on/off etc....
_________________ Spup Frugal HD and USB
Root forever!
|
Back to top
|
|
 |
noryb009
Joined: 20 Mar 2010 Posts: 636
|
Posted: Mon 02 Aug 2010, 08:20 Post subject:
|
|
Yes! I got it working!
The only thing is the media command keys. Does puppy 501 USE amixer, or just has it installed? If it isn't enabled by default, how do I take zmixer out and put amixer in?
|
Back to top
|
|
 |
|
Page 1 of 2 [21 Posts] |
Goto page: 1, 2 Next |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|