From owner-freebsd-questions@FreeBSD.ORG Mon Sep 14 21:06:23 2009 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6B7AA1065679 for ; Mon, 14 Sep 2009 21:06:23 +0000 (UTC) (envelope-from freebsd@edvax.de) Received: from mx02.qsc.de (mx02.qsc.de [213.148.130.14]) by mx1.freebsd.org (Postfix) with ESMTP id 2B0F38FC08 for ; Mon, 14 Sep 2009 21:06:22 +0000 (UTC) Received: from r55.edvax.de (port-92-195-23-67.dynamic.qsc.de [92.195.23.67]) by mx02.qsc.de (Postfix) with ESMTP id F0A531E105; Mon, 14 Sep 2009 23:06:21 +0200 (CEST) Received: from r55.edvax.de (localhost [127.0.0.1]) by r55.edvax.de (8.14.2/8.14.2) with SMTP id n8EL6K0v002229; Mon, 14 Sep 2009 23:06:21 +0200 (CEST) (envelope-from freebsd@edvax.de) Date: Mon, 14 Sep 2009 23:06:20 +0200 From: Polytropon To: Robert Huff Message-Id: <20090914230620.2f7dd3d4.freebsd@edvax.de> In-Reply-To: <19118.36021.489954.856994@jerusalem.litteratus.org> References: <20090914173420.GB69286@slackbox.xs4all.nl> <19118.36021.489954.856994@jerusalem.litteratus.org> Organization: EDVAX X-Mailer: Sylpheed 2.4.7 (GTK+ 2.12.1; i386-portbld-freebsd7.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: Roland Smith , Eitan Adler , freebsd-questions@freebsd.org Subject: Re: rebinding keys to functions X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Polytropon List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Sep 2009 21:06:23 -0000 On Mon, 14 Sep 2009 14:34:29 -0400, Robert Huff wrote: > Roland Smith writes: > > > > My laptop has a bunch of volume-up/down/mute internet/mail/etc > > > keys. How do I map each of them to run a specific shell > > > command when pressed? > > > > That depends on a couple of things (assuming you're running the X > > window system, I don't know if it is even possible on the > > console). > > > > First you have to make sure that you actually can see the key > > signals. In X you can test that with xev(1). > > If this is what I think it is, he probably can't. For most laptop keyboards, there was (as already explained) a specific system that handled Fn+PFx outside the OS so it worked always. Even my old Toshiba T1600 can do that. "Modern" laptops do it differently: Fn+PFx key combinations have to be picked up by a specific driver that "listens" to stange and custom keycodes outside the standard range, and then communicate the selected purpose to the OS in order to perform the action, e. g. raise the volume. Even worse, "modern" laptops have replaced the simple switches in the earophone sockets. In the past, there was a mechanical switch that switched off the internal speakers when you inserted a 3,5mm jack. Today, a proprietary driver has to detect if a jack is inserted, and then switch of the speakers and then switch on the output of the socket. > I have a Logitech iTouch keyboard; it has eighteen buttons and > two dials. None of them register under xev. The Apple USB keyboard is something similar. Allthough most keys show up in xev, F13 and the four additional four keys on the right (volume, eject) don't show up. I've been advised that it is quite possible to look into the ukbd driver subsystem, add some debugging and log what happens when those keys are pressed; they can then be assigned a specific number which afterwards resolves tp a certain key symbol. Would be great if they worked... But life can be so easy when you've got good hardware, such as the Sun USB type 6 keyboard. The 2x5 and 1 keys on the left as well as the four keys on the top right show up in xev. I'm using a xmodmap file ~/.xmodmaprc to map them to a certain (arbitrary) key name, like ! Stop keycode 145 = F14 ! Meta links keycode 115 = Meta_L ! Meta rechte keycode 116 = Meta_R ! Compose keycode 117 = Multi_key add mod4 = Multi_key After that, I can use the config tool of WindowMaker to connect those key names to actions, like rolling up or hiding windows, running specific programs or performing other actions (e. g. moon key = log off, Ctrl+Alt+Moon = shutdown now; help = xlock). -- Polytropon Magdeburg, Germany Happy FreeBSD user since 4.0 Andra moi ennepe, Mousa, ...