From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Rusi Newsgroups: gmane.emacs.help Subject: Re: How bind "Super" key *all by itself* to a function? Date: Mon, 19 Jan 2015 06:33:21 -0800 (PST) Message-ID: References: <43af9344-5981-4250-a825-47e119c1633e@googlegroups.com> <50ee152f-7dd7-4325-8b38-728e3e971338@googlegroups.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: ger.gmane.org 1421678179 11414 80.91.229.3 (19 Jan 2015 14:36:19 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 19 Jan 2015 14:36:19 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Jan 19 15:36:19 2015 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YDDRC-0001hc-Pi for geh-help-gnu-emacs@m.gmane.org; Mon, 19 Jan 2015 15:36:18 +0100 Original-Received: from localhost ([::1]:37773 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YDDRC-0007ma-1n for geh-help-gnu-emacs@m.gmane.org; Mon, 19 Jan 2015 09:36:18 -0500 X-Received: by 10.68.241.163 with SMTP id wj3mr22952299pbc.8.1421678002696; Mon, 19 Jan 2015 06:33:22 -0800 (PST) X-Received: by 10.50.129.98 with SMTP id nv2mr236071igb.1.1421678002567; Mon, 19 Jan 2015 06:33:22 -0800 (PST) Original-Path: usenet.stanford.edu!r10no1382273igi.0!news-out.google.com!db6ni2591igc.0!nntp.google.com!r10no780380igi.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=59.95.11.96; posting-account=mBpa7woAAAAGLEWUUKpmbxm-Quu5D8ui Original-NNTP-Posting-Host: 59.95.11.96 User-Agent: G2/1.0 Injection-Date: Mon, 19 Jan 2015 14:33:22 +0000 Original-Xref: usenet.stanford.edu gnu.emacs.help:209879 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:102158 Archived-At: On Monday, January 19, 2015 at 2:38:06 PM UTC+5:30, Yuri Khan wrote: > [Damn Gmail. Its Send button is too near the "show quote" button and > too high-contrast.] > > On Mon, Jan 19, 2015 at 1:35 PM, Rusi wrote: > > >> However, you can use XKB (in X) and/or loadkeys (in tty) to map the > >> Windows key to produce a different keycode such as F13, and then bind > >> that to any function you like. > > > > Do you have a simple howto on that? [XKB] > > With xmodmap it was at least conceivable > > Xkb is too much of a dragon > > > > eg Say I have a broken ~ key and I want to make F12 generate ~ > > Not quite qualifies as "simple" but not very complicated. > > * Find the XKB data directory. [Normally, this is /usr/share/X11/xkb.] > * In its "keycodes" subdirectory, create a file that is unlikely to be > overwritten by a future version of XKB (e.g. by prefixing it with your > initials). [Let's name it "rusi" for the sake of this example.] > * In this file, paste the following: > > === > xkb_keycodes "f12tilde" { > # remappings go here... > }; > > # you can have multiple remapping sections > # and activate any subset thereof, just add more > # xkb_keycodes "some_name" { > # # ... > # }; > === > > Each remapping takes the form: = KEYCODE; > > Refer to the existing entries in the section "default xkb_keycodes > "evdev"" for key names and codes. > > For keyname, find the name of the key you want to generate. In your > case, it's . > > For keycode, find the numeric code of the key you want to remap. In > your case, it's the code which is normally bound to , namely, > 96. > > So: > > === > = 96; > === > > * Now that you have a keycodes section of your own, make a > corresponding option. In the rules/evdev file, find the following > header: > > === > ! option = keycodes > === > > In that section, add something like: > > === > rusi:f12tilde = +rusi(f12tilde) > === > > Here, the form on the right refers to the keycodes filename and > section, and the name on the left specifies the option name. > > * Next, you want your X server to pick up this option. You can do it > system-wide or per-user; I'll describe the system-wide setup because I > find it easier and less DE-specific. > * In the /usr/share/X11/xorg.conf.d directory [or its equivalent on > your system], create a uniquely named file [e.g. > 11-rusi-keycodes.conf]: > > === > Section "InputClass" > Identifier "Keyboard layouts" > Driver "evdev" > Option "XkbOptions" "rusi:f12tilde" > Option "AutoServerLayout" "on" > MatchIsKeyboard "on" > MatchDevicePath "/dev/input/event*" > EndSection > === > > In the XkbOptions line, refer to the option name you added to rules/evdev. > > Next time you boot X or plug in a keyboard, it should use your customization. > > You can check the current set of XKB options by executing the > following command in a terminal emulator within an X session: > > $ setxkbmap -query > > ---- !WORKS! So where does one get initiated into the school of black art? ie how do I figure out what those incantations mean? One of my problems is how to debug: If some small thing goes wrong and it does not work... where to start looking? > > Legend has it that there is a possibility of using xkbcomp(1) on a > user-specific configuration file, but I never learned that; > system-wide is good enough for me. > > One caveat: whenever you update the package that contains the > rules/evdev file, it may be overwritten and you might have to re-add > your option line.