From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Yuri Khan Newsgroups: gmane.emacs.help Subject: Re: How bind "Super" key *all by itself* to a function? Date: Mon, 19 Jan 2015 16:08:00 +0700 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=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1421658500 4481 80.91.229.3 (19 Jan 2015 09:08:20 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 19 Jan 2015 09:08:20 +0000 (UTC) Cc: "help-gnu-emacs@gnu.org" To: Rusi Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Jan 19 10:08: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 1YD8Jl-0002jQ-8C for geh-help-gnu-emacs@m.gmane.org; Mon, 19 Jan 2015 10:08:17 +0100 Original-Received: from localhost ([::1]:36200 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YD8Jk-0002qD-37 for geh-help-gnu-emacs@m.gmane.org; Mon, 19 Jan 2015 04:08:16 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:45652) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YD8JV-0002m4-Lq for help-gnu-emacs@gnu.org; Mon, 19 Jan 2015 04:08:02 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YD8JU-0003d9-K5 for help-gnu-emacs@gnu.org; Mon, 19 Jan 2015 04:08:01 -0500 Original-Received: from mail-qc0-x234.google.com ([2607:f8b0:400d:c01::234]:63448) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YD8JU-0003cL-DM for help-gnu-emacs@gnu.org; Mon, 19 Jan 2015 04:08:00 -0500 Original-Received: by mail-qc0-f180.google.com with SMTP id r5so18888362qcx.11 for ; Mon, 19 Jan 2015 01:08:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type:content-transfer-encoding; bh=yVWSNzs6Y3aHV2jwjXZBQtz1hCeVDboln+oaHAtW800=; b=wEV/sYD9hO0HPYFErV2dII0DMDv+AUUhXncSsepPR73GY17oFLgCzbQ1a/ym2hn4S9 4hb+V3J4TkK6OXQxfdZ/EN7OR7/UJ4D2YPvNKLHInhY8MJzwLMV/zMSKNK3KVkAYjDQB 9VRTQeELfH5v0AHTzamQe9/E5CM7AF9KXK4U7ihmj6siNlHw5ndwU8KpvQ5YroDNHwj5 z7GiLrn118LePazwwME5p5+rrOtefSWCl5F3l2EtkAqtlrLFIHc1uS4W/Vw5CUc8HXdn B7HD+FxqLq1bQwqP16GxYeO+4JDrsucxMU2w9yIcB9UtipVIiwnH0hNSqm1nG5NHgwp6 c72w== X-Received: by 10.140.98.2 with SMTP id n2mr13389218qge.62.1421658480110; Mon, 19 Jan 2015 01:08:00 -0800 (PST) Original-Received: by 10.96.141.105 with HTTP; Mon, 19 Jan 2015 01:08:00 -0800 (PST) In-Reply-To: <50ee152f-7dd7-4325-8b38-728e3e971338@googlegroups.com> X-Google-Sender-Auth: _tBFg4qGGoPma05D5_NUymMq2Nk X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:400d:c01::234 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:102154 Archived-At: [Damn Gmail. Its Send button is too near the =E2=80=9Cshow quote=E2=80=9D b= utton 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 =E2=80=9Csimple=E2=80=9D but not very complicated. * Find the XKB data directory. [Normally, this is /usr/share/X11/xkb.] * In its =E2=80=9Ckeycodes=E2=80=9D subdirectory, create a file that is unl= ikely to be overwritten by a future version of XKB (e.g. by prefixing it with your initials). [Let=E2=80=99s name it =E2=80=9Crusi=E2=80=9D for the sake of th= is example.] * In this file, paste the following: =3D=3D=3D xkb_keycodes "f12tilde" { # remappings go here=E2=80=A6 }; # you can have multiple remapping sections # and activate any subset thereof, just add more # xkb_keycodes "some_name" { # # =E2=80=A6 # }; =3D=3D=3D Each remapping takes the form: =3D KEYCODE; Refer to the existing entries in the section =E2=80=9Cdefault xkb_keycodes "evdev"=E2=80=9D for key names and codes. For keyname, find the name of the key you want to generate. In your case, it=E2=80=99s . For keycode, find the numeric code of the key you want to remap. In your case, it=E2=80=99s the code which is normally bound to , namely, 96. So: =3D=3D=3D =3D 96; =3D=3D=3D * Now that you have a keycodes section of your own, make a corresponding option. In the rules/evdev file, find the following header: =3D=3D=3D ! option =3D keycodes =3D=3D=3D In that section, add something like: =3D=3D=3D rusi:f12tilde =3D +rusi(f12tilde) =3D=3D=3D 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=E2=80=99ll describe the system-wide setup becaus= e 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]: =3D=3D=3D Section "InputClass" Identifier "Keyboard layouts" Driver "evdev" Option "XkbOptions" "rusi:f12tilde" Option "AutoServerLayout" "on" MatchIsKeyboard "on" MatchDevicePath "/dev/input/event*" EndSection =3D=3D=3D 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 customizatio= n. You can check the current set of XKB options by executing the following command in a terminal emulator within an X session: $ setxkbmap -query ---- 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.