1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=iso-8859-1">
<TITLE></TITLE>
<META NAME="GENERATOR" CONTENT="StarOffice/5.2 (Linux)">
<META NAME="CREATED" CONTENT="20020623;19034600">
<META NAME="CHANGEDBY" CONTENT=" ">
<META NAME="CHANGED" CONTENT="20020623;19572700">
<STYLE>
<!--
@page { size: 8.5in 11in; margin-left: 1.25in; margin-right: 1.25in; margin-top: 1in; margin-bottom: 1in }
P { margin-bottom: 0.08in }
H1 { margin-bottom: 0.08in; font-family: "helvetica", sans-serif; font-size: 16pt }
P.cuerpo-de-texto-con-sangra { margin-left: 0.2in }
-->
</STYLE>
</HEAD>
<BODY>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in">This is the firs version
of the Multimedia-X-Keyboard-HOWTO</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in">This HOWTO was written by
Lord Darth Moultak <<A HREF="mailto:moultak@gothicfuneral.zzn.com">moultak@gothicfuneral.zzn.com</A>></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in">The latest version of
this HOWTO can be found at <A HREF="http://www.sourceforge.net/projects/osdsh">http://www.sourceforge.net/projects/osdsh</A></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<H1 ALIGN=JUSTIFY STYLE="font-weight: medium; text-decoration: none"><I>How
to configure the internet keys on your multimedia keyboard, without
using extra daemons, just X and the window manager you already run.</I></H1>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: medium; text-decoration: none">
<BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-top: 0.17in; page-break-after: avoid"><FONT FACE="helvetica, sans-serif"><FONT SIZE=4>Introduction:</FONT></FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in">Some time ago,
manufacturers of computers started shipping their hardware with
keyboards that had "extra" keys on them, these keys were
meant to control internet and multimedia features of the system, like
playing/stoping/pausing cds and MP3's, connecting to the internet,
starting mail and chat programs, and sleeping or suspending the
computer, and were marked as such. This is nice, these keyboards look
nice and they are comfortable to work with, those keys always come in
handy, but they are a pain to configure in X. This is how I did it.</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-top: 0.17in; page-break-after: avoid"><FONT FACE="helvetica, sans-serif"><FONT SIZE=4>The
theory:</FONT></FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in">When a key is pressed,
the keyboard generates a code that the kernel detects, this code is
known as "keycode". When X detects a keycode, it looks in a
table of symbols to see if that keycode means something. The symbols
are the way the software understands the keys, like TAB, UP, DOWN,
CTRL, etc...</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in">If the keycode does mean
something, (that is, a symbol is asigned to it) the symbol goes to
the application that has the keyboard control, like a text editor or
a game.</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in">X comes with a series of
"keymaps", (files that contain the keycode-keysym pairs )
that work for a lot of keyboards, and even with some "Internet
keys", but at least for me, the internet keys were dead. So I
needed a new keymap.</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in">Since the normal keys
already worked fine, I just needed to add the keycode-keysym pairs
that would make my keys work. To do this there is a utility (also
part of X) called <I>xmodmap</I>.</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><I>xmodmap</I> reads a
file or std input for "commands". The commands are in the
form of</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P CLASS="cuerpo-de-texto-con-sangría" ALIGN=JUSTIFY>keycode
$keycode = $keysym</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in">where $keycode is the
actual keycode (the first "keycode" needs to be there).</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in">This tells <I>xmodmap</I>
to assign the specified keysym to that keycode. Since when you log
out you lose the asignments, you need to load them when you start X.
(X automatically loads a keymap from its configuration file) This is
done adding a line like:</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P CLASS="cuerpo-de-texto-con-sangría" ALIGN=JUSTIFY STYLE="font-style: normal; font-weight: medium; text-decoration: none">
xmodmap yourkeymap</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in">to your .xinitrc or
.Xsession file</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in">Now they get recognized,
but they dont do anything!!! you say.</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in">That is true, any
software can now recognize the keys, but they are not doing anything
useful, like starting programs, changing the volume or connecting to
the internet. We will leave this to the window manager.</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in">Most window managers can
be configured to do something when a key or a combination of keys is
pressed, like Alt-Tab to switch or cicle the windows, and we are
going to use this feature to start the programs that will actually do
something useful.</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in">In WindowMaker, the
configuration utility has a section for this. For blackbox there is a
program called bbkeys that handles the "keyboard shortcuts".</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in">I can give no advice in
this part, since each window manager works different, but in the
documentation of yours, you can get the info you need. Look for
"keyboard shortcuts" or something like that.</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-top: 0.17in; page-break-after: avoid"><FONT FACE="helvetica, sans-serif"><FONT SIZE=4>The
practice:</FONT></FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in">Well, lets get our hands
on this...</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in">First, pick up a key (the
leftmost, the rightmost, the bigger one) of your internet keys.
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in">In an xterm write</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P CLASS="cuerpo-de-texto-con-sangría" ALIGN=JUSTIFY>$ xev</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in">you will get a window
with a square on it. Now press the key you chose.</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in">It will read something
like:</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P CLASS="cuerpo-de-texto-con-sangría" ALIGN=JUSTIFY>KeyPress
event, serial 19, synthetic NO, window 0x2200001,</P>
<P CLASS="cuerpo-de-texto-con-sangría" ALIGN=JUSTIFY> root
0x27, subw 0x0, time 2565600158, (136,110), root:(350,340),</P>
<P CLASS="cuerpo-de-texto-con-sangría" ALIGN=JUSTIFY> state
0x10, keycode 149 (keysym 0x1000410e, IA14), same_screen YES,</P>
<P CLASS="cuerpo-de-texto-con-sangría" ALIGN=JUSTIFY>
XLookupString gives 0 characters: ""</P>
<P CLASS="cuerpo-de-texto-con-sangría" ALIGN=JUSTIFY><BR><BR>
</P>
<P CLASS="cuerpo-de-texto-con-sangría" ALIGN=JUSTIFY>KeyRelease
event, serial 24, synthetic NO, window 0x2200001,</P>
<P CLASS="cuerpo-de-texto-con-sangría" ALIGN=JUSTIFY> root
0x27, subw 0x0, time 2565600304, (136,110), root:(350,340),</P>
<P CLASS="cuerpo-de-texto-con-sangría" ALIGN=JUSTIFY> state
0x10, keycode 149 (keysym 0x1000410e, IA14), same_screen YES,</P>
<P CLASS="cuerpo-de-texto-con-sangría" ALIGN=JUSTIFY>
XLookupString gives 0 characters: ""</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in">now press Ctrl-c in the
xterm and look at the third line of each block, there is a keycode in
decimal (in this case, 149) and a keysym (in this case IA14). Ok, if
you had not assigned any keysym to your inet keys, instead of IA14
you will get something like NoKeysym.</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in">The X guys have set aside
some special keysyms for the inet keys, they go from IA1 to IA15 and
IB1 to IB15. This gives us a total of 30 keysyms. This has to be
enough for any keyboard.</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in">write a file "yourkeymap"
that reads
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P CLASS="cuerpo-de-texto-con-sangría" ALIGN=JUSTIFY>keysym
149 = IA14</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in">(change the values
acording with what you got, if you got a NoKeysym, choose a keysym
from the ones mentioned above, IA1 looks nice for a start)</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in">now from the xterm do:</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P CLASS="cuerpo-de-texto-con-sangría" ALIGN=JUSTIFY STYLE="font-style: normal">
$ xmodmap yourkeymap</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in">and repeat the thing with
<I>xev</I>. Start it and press the key you pressed before. You will
get a similar output, but instead of the NoKeysym you will get the
keysym you wrote in your file.</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in">Add a line for each key
you want to configure. Don't repeat keysyms (unless you want several
keys to do the exact same thing). Reload your keymap with:</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P CLASS="cuerpo-de-texto-con-sangría" ALIGN=JUSTIFY STYLE="font-style: normal">
$ xmodmap yourkeymap</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in">Now copy the yourkeymap
file to ~/.yourkeymap.</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in">Edit your ~/.xinitrc or
~/.Xsession file to add a line that says:</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P CLASS="cuerpo-de-texto-con-sangría" ALIGN=JUSTIFY STYLE="font-style: normal">
xmodmap ~/.yourkeymap</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in">This is done to load the
keys when you start X.</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in">Instead of doing all
this, you may want to check my program "keymapconfig" that
asks you to press a key and then asks you for the keysym to asign to
it. You can save this pairs to a file and load them later with
<I>xmodmap</I>... It requieres Tcl/Tk. Try to use only the keysyms
specified above (IA1 to IA15 and IB1 to IB15) to avoid conflicts and
problems. Anyway 30 keys are more than enough for internet and
multimedia stuff.</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in">(You have already
downloaded this program, with this howto, look in the directory where
you untarred the tarball)</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in">You still have to add
that line in your .xinitrc or .Xsession to load your keymap when you
start X.</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in">Now you have to configure
the applications that do the work. This is configuration of your
window manager, and each window manager will have different
instructions, but most of them will work.</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in">Basically, when asked for
the key to watch (or “keyboard shortcut”), just write the
keysym you asigned to the key you want to do something (or press that
key, the “Key” is in fact the keysym, not actually the key)
and then write the command you want to run when you press that key.</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in">You can also use these
keys in combination with modifiers like Ctrl, Shift and Alt. For
example, I use the "Play" key to start xmms, but if I want
to play a CD, I use Ctrl-Play to start gcd; for me Play is IB3 so I
configured Ctrl-IB3 to start gcd. I also use the "Suspend"
key to suspend the computer by running "apm -s", but if I
want to see the battery status, I use Ctrl-Sleep to run "osdctl
-A 3", that displays the battery status using osdsh (Read
below). Again, for me "Suspend" is IA5, so to run "apm
-s" I asigned the key IA5 and to run "osdctl -A 3" I
asigned Ctrl-IA5.</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in">For volume control, I
recommend using umix, for terminals aterm is nice and for the
"Connect" key, put the command you use to connect. Its that
simple.</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in">As an adition, you may
want to check osdsh (by me of course), its a daemon that monitors the
sound card volume, battery and connection status, displays a clock
and displays it all using the XOSD library, so you get a nice TV-like
On-Screen-Display for your sound, batt, connection and a sexy clock
floating unmanaged on your display.</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><A HREF="http://www.sourceforge.net/projects/osdsh">http://www.sourceforge.net/projects/osdsh</A></P>
</BODY>
</HTML>
|