summaryrefslogtreecommitdiff
path: root/HOWTO
diff options
context:
space:
mode:
authorAndrej Shadura <andrewsh@debian.org>2019-01-07 13:03:16 +0100
committerAndrej Shadura <andrewsh@debian.org>2019-01-07 13:03:16 +0100
commit4a208f73cdc30fbd0f6f3b700469d0fa1ab2e646 (patch)
treeb4481f16ce9331e1b45a1fcf26827d136d1215d8 /HOWTO
Import Upstream version 0.7.0
Diffstat (limited to 'HOWTO')
-rw-r--r--HOWTO/Multimedia-X-Keyboard-HOWTO.html301
-rw-r--r--HOWTO/README26
-rwxr-xr-xHOWTO/keymapconfig134
3 files changed, 461 insertions, 0 deletions
diff --git a/HOWTO/Multimedia-X-Keyboard-HOWTO.html b/HOWTO/Multimedia-X-Keyboard-HOWTO.html
new file mode 100644
index 0000000..3e4d5ac
--- /dev/null
+++ b/HOWTO/Multimedia-X-Keyboard-HOWTO.html
@@ -0,0 +1,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-sangrķa { 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 &lt;<A HREF="mailto:moultak@gothicfuneral.zzn.com">moultak@gothicfuneral.zzn.com</A>&gt;</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 &quot;extra&quot; 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 &quot;keycode&quot;. 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
+&quot;keymaps&quot;, (files that contain the keycode-keysym pairs )
+that work for a lot of keyboards, and even with some &quot;Internet
+keys&quot;, 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 &quot;commands&quot;. The commands are in the
+form of</P>
+<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
+</P>
+<P CLASS="cuerpo-de-texto-con-sangr&iacute;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 &quot;keycode&quot; 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&iacute;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 &quot;keyboard shortcuts&quot;.</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
+&quot;keyboard shortcuts&quot; 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&iacute;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&iacute;a" ALIGN=JUSTIFY>KeyPress
+event, serial 19, synthetic NO, window 0x2200001,</P>
+<P CLASS="cuerpo-de-texto-con-sangr&iacute;a" ALIGN=JUSTIFY> root
+0x27, subw 0x0, time 2565600158, (136,110), root:(350,340),</P>
+<P CLASS="cuerpo-de-texto-con-sangr&iacute;a" ALIGN=JUSTIFY> state
+0x10, keycode 149 (keysym 0x1000410e, IA14), same_screen YES,</P>
+<P CLASS="cuerpo-de-texto-con-sangr&iacute;a" ALIGN=JUSTIFY>
+XLookupString gives 0 characters: &quot;&quot;</P>
+<P CLASS="cuerpo-de-texto-con-sangr&iacute;a" ALIGN=JUSTIFY><BR><BR>
+</P>
+<P CLASS="cuerpo-de-texto-con-sangr&iacute;a" ALIGN=JUSTIFY>KeyRelease
+event, serial 24, synthetic NO, window 0x2200001,</P>
+<P CLASS="cuerpo-de-texto-con-sangr&iacute;a" ALIGN=JUSTIFY> root
+0x27, subw 0x0, time 2565600304, (136,110), root:(350,340),</P>
+<P CLASS="cuerpo-de-texto-con-sangr&iacute;a" ALIGN=JUSTIFY> state
+0x10, keycode 149 (keysym 0x1000410e, IA14), same_screen YES,</P>
+<P CLASS="cuerpo-de-texto-con-sangr&iacute;a" ALIGN=JUSTIFY>
+XLookupString gives 0 characters: &quot;&quot;</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 &quot;yourkeymap&quot;
+that reads
+</P>
+<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
+</P>
+<P CLASS="cuerpo-de-texto-con-sangr&iacute;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&iacute;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&iacute;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&iacute;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 &quot;keymapconfig&quot; 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 &#147;keyboard shortcut&#148;), just write the
+keysym you asigned to the key you want to do something (or press that
+key, the &#147;Key&#148; 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 &quot;Play&quot; 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 &quot;Suspend&quot;
+key to suspend the computer by running &quot;apm -s&quot;, but if I
+want to see the battery status, I use Ctrl-Sleep to run &quot;osdctl
+-A 3&quot;, that displays the battery status using osdsh (Read
+below). Again, for me &quot;Suspend&quot; is IA5, so to run &quot;apm
+-s&quot; I asigned the key IA5 and to run &quot;osdctl -A 3&quot; 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
+&quot;Connect&quot; 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> \ No newline at end of file
diff --git a/HOWTO/README b/HOWTO/README
new file mode 100644
index 0000000..52a4689
--- /dev/null
+++ b/HOWTO/README
@@ -0,0 +1,26 @@
+Keymapconfig README
+
+What is this?
+
+ keymapconfig is a Tcl/Tk script that generates keymaps to be loaded
+into the X window sistem thru the utility called xmodmap.
+
+ keymapconfig reads the keycode of a key and asks for a keysym t
+be assigned to it. It can save the keycode-keysym pairs to a file that
+can be then feed to xmodmap, and can run xmodmap itself to try the keys
+
+ It also can load these files to edit them.
+
+ Read the manual pages of xmodmap to understand this.
+
+
+ The reason I wrote this is that I needed a tool to grab the keycodes
+of the internet keys on my multimedia keyboard, this can be done with the
+utility "xev" that is part of X, but I also needed to edit the keysyms and
+assign them to keycodes, so after doing it manually a few times, I wrote this
+program so other people can get their multimedia keys working.
+I also did it as a tool for my Multimedia-X-Keyboard-HOWTO.
+
+Installation
+
+ Just copy it somewhere in your path. It needs Tcl/Tk.
diff --git a/HOWTO/keymapconfig b/HOWTO/keymapconfig
new file mode 100755
index 0000000..319e82b
--- /dev/null
+++ b/HOWTO/keymapconfig
@@ -0,0 +1,134 @@
+#!/usr/bin/wish
+
+wm title . "Keymap Configurator"
+set status "Ready"
+
+entry .status -textvariable status
+button .b1 -text "New Key" -command "new_key"
+button .b2 -text "Edit Key" -command "edit_key"
+button .b3 -text "Delete Key" -command "delete_key"
+button .b4 -text "Load Keymap" -command "load_keymap"
+button .b5 -text "Save Keymap" -command "save_keymap"
+button .b6 -text "Quit" -command "destroy ."
+button .b7 -text "Try this keys" -command "try_keys"
+
+label .keyslabel -text "Current keys: "
+listbox .keys -yscrollcommand ".keysscroll set"
+scrollbar .keysscroll -command ".keys yview"
+
+grid .keyslabel -column 0 -columnspan 3 -row 0 -sticky nsew
+grid .keys -column 0 -rowspan 5 -sticky nsew -row 1
+grid .keysscroll -column 1 -rowspan 5 -row 1 -sticky nsew
+grid .b7 -column 0 -columnspan 2 -row 6 -sticky nsew
+
+grid .b1 -column 2 -row 1 -sticky nsew
+grid .b2 -column 2 -row 2 -sticky nsew
+grid .b3 -column 2 -row 3 -sticky nsew
+grid .b4 -column 2 -row 4 -sticky nsew
+grid .b5 -column 2 -row 5 -sticky nsew
+grid .b6 -column 2 -row 6 -sticky nsew
+
+grid .status -column 0 -row 7 -columnspan 3 -sticky nsew
+
+focus .b1
+
+proc new_key {} {
+ global status keycode keysym where
+ set status "Press a Key"
+ set where "end"
+ set keysym ""
+ set keycode ""
+ .status configure -foreground red
+# toplevel .getkey
+# label .getkey.label -text "Press a key here"
+# pack .getkey.label -fill both -expand 1
+ bind . <KeyPress> {set keycode %k;bind . <KeyPress> {};;get_keysym}
+}
+
+
+proc add_key {} {
+ global status keycode keysym where
+ set status "Ready"
+ .keys insert $where "keycode $keycode = $keysym"
+}
+
+proc delete_key {} {
+ .keys delete active
+}
+
+proc edit_key {} {
+ global status keycode keysym where
+ set where [.keys index active]
+ set lista [split [.keys get active]]
+ set keycode [lindex $lista 1]
+ set keysym [lindex $lista 3]
+ toplevel .edit
+ wm title .edit "Edit Key"
+ label .edit.label -text "Enter the keysym to assign to this keycode"
+ label .edit.keycode -text "Keycode $keycode = "
+ entry .edit.entry -textvariable keysym -width 15
+ button .edit.button -text "OK" -command "delete_key;add_key;destroy .edit"
+ button .edit.button2 -text "Cancel" -command "destroy .edit"
+ bind .edit.entry <Return> "delete_key; add_key; destroy .edit"
+ bind .edit.entry <Escape> "destroy .edit"
+
+ grid .edit.label -sticky nsew -row 0 -columnspan 4
+ grid .edit.keycode .edit.entry .edit.button2 .edit.button -row 1 -sticky nsew
+
+}
+
+proc save_keymap {} {
+ global status
+ set file [tk_getSaveFile]
+ if {![string equal $file ""]} {
+ set id [open $file w]
+
+ for {set i 0} {[expr $i < [.keys index end]]} {incr i} {
+ puts $id [string map {"\{" "" "\}" ""} [.keys get $i]]
+ }
+
+ close $id
+ }
+ set status "Saved keymap in $file"
+}
+
+proc get_keysym {} {
+ global status keycode keysym
+ toplevel .keysym
+ wm title .keysym "Add key"
+ label .keysym.label -text "Enter the keysym to assign\nRecommended: IA1-IA15 or IB1-IB15"
+ entry .keysym.entry -textvariable keysym
+ button .keysym.button -text "OK" -command "add_key; destroy .keysym"
+ grid .keysym.label -row 0 -columnspan 5 -sticky nsew
+ grid .keysym.entry -row 1 -columnspan 4 -sticky nsew
+ grid .keysym.button -row 1 -columnspan 1 -column 5 -sticky nsew
+ bind .keysym.entry <Return> "add_key ; destroy .keysym"
+ focus .keysym.entry
+ .status configure -foreground black
+ set status "Ready"
+}
+
+proc try_keys {} {
+ global status
+ set id [open tmpfile w+]
+ for {set i 0} {$i < [.keys index end]} {incr i} {
+ puts $id [string map {"\{" "" "\}" ""} [.keys get $i]]
+ }
+ close $id
+ exec xmodmap tmpfile
+}
+
+proc load_keymap {} {
+ global status where
+ .keys delete 0 end
+ set file [tk_getOpenFile]
+ if {$file != ""} {
+ set id [open $file r]
+ while {[gets $id readbuffer] > 0} {
+ .keys insert end $readbuffer
+ }
+ close $id
+ set status "Read $file"
+ }
+}
+