From owner-freebsd-questions@FreeBSD.ORG Thu Dec 27 19:14:32 2007 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 9ACC416A417 for ; Thu, 27 Dec 2007 19:14:32 +0000 (UTC) (envelope-from freebsd-questions@slightlystrange.org) Received: from catflap.slightlystrange.org (cpc5-cmbg1-0-0-cust497.cmbg.cable.ntl.com [86.6.1.242]) by mx1.freebsd.org (Postfix) with ESMTP id 2F5BD13C442 for ; Thu, 27 Dec 2007 19:14:32 +0000 (UTC) (envelope-from freebsd-questions@slightlystrange.org) Received: by catflap.slightlystrange.org (Postfix, from userid 106) id 6E7E4617F; Thu, 27 Dec 2007 19:14:30 +0000 (GMT) Received: from torus.slightlystrange.org (torus.slightlystrange.org [10.1.3.50]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by catflap.slightlystrange.org (Postfix) with ESMTP id C6C3560E8 for ; Thu, 27 Dec 2007 19:14:29 +0000 (GMT) Received: (from danielby@localhost) by torus.slightlystrange.org (8.14.2/8.13.4/Submit) id lBRJESF0023754 for freebsd-questions@freebsd.org; Thu, 27 Dec 2007 19:14:28 GMT (envelope-from freebsd-questions@slightlystrange.org) Date: Thu, 27 Dec 2007 19:14:27 +0000 From: Daniel Bye To: freebsd-questions@freebsd.org Message-ID: <20071227191427.GA1076@torus.slightlystrange.org> Mail-Followup-To: freebsd-questions@freebsd.org References: <80f4f2b20712270836x43c08626yc274eeba5c71f7fe@mail.gmail.com> <1581622098.20071227205006@bk.ru> <18291.60523.175555.968377@jerusalem.litteratus.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="AqsLC8rIMeq19msA" Content-Disposition: inline In-Reply-To: <18291.60523.175555.968377@jerusalem.litteratus.org> User-Agent: Mutt/1.4.2.3i X-PGP-Fingerprint: D349 B109 0EB8 2554 4D75 B79A 8B17 F97C 1622 166A Subject: Re: Logitech keyboard/mouse? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Daniel Bye List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Dec 2007 19:14:32 -0000 --AqsLC8rIMeq19msA Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Dec 27, 2007 at 01:18:19PM -0500, Robert Huff wrote: >=20 > As long as we're in the viciity: > I have a Logitech i-Touch keyboard; standard 104 (or whatever > it is these days) setup plus a dozen extra buttons and two dials. > Great product. > It would be even greater if > a) I could get X to register/comunicate all the extra stuff > and > b) programs understood and used those inputs. > Has anyone seen this done? I'd dearly loce to be able to use > the little dial by the TAB key for volume control in xmms. I tinkered with this stuff a while ago. Let me see if I can remember how (an object lesson in making copious notes whenever you try something new, I guess...) To find out what keycodes your extra keys are bound to, run xev(1) from an Xterm or similar. With your mouse pointer over the little window that pops up, hit each extra key you are interested in and make a note of its keycode value. Quit xev(1) and edit or create ~/.Xmodmap, which allows you to assign keysyms to particular keycodes, etc (see xmodmap(1) for the full story). On my keyboard, turning the dial clockwise generates keycode 176, and anti-clockwise 174 which I map to the XF86AudioRaiseVolume and XF86AudioLowerVolume keysyms: keycode 176 =3D XF86AudioRaiseVolume keycode 174 =3D XF86AudioLowerVolume I also have a mute button next to the dial which generates 140: keycode 140 =3D XF86AudioMute (A full list of keysyms can be found in /usr/local/lib/X11/XKeysymDB) For this to be useful, you need to figure out how your window manager=20 handles keyboard customisation.[1] Under XFCE4, the Keyboard settings applet allows creation of keyboard shortcuts by attaching commands to keysyms. For example, to change the mixer volume, I have=20 `aumix -v +10' assigned to XF86AudioRaiseVolume and `aumix -v -10' assigned to XF86AudioLowerVolume. (aumix is available in the ports). I have assigned a custom shell script to the mute button (XF86AudioMute) which toggles the volume on or off: #!/bin/sh -x # If we are currently playing, mute the speakers and register current # volume level in /tmp/mute-${XINE_PID} # # If mute (ie, if mute-${XINE_PID} exists), restore volume to the level # recorded in the file, and remove the file. XINE_PID=3D$(pgrep xine) if [ -f "/tmp/mute-${XINE_PID}" ] then VOL=3D$(cat "/tmp/mute-${XINE_PID}") aumix -v${VOL} rm "/tmp/mute-${XINE_PID}" else VOL=3D$(aumix -q | awk '/^vol/ {print $2}' | sed -e 's/,//') echo ${VOL} > "/tmp/mute-${XINE_PID}" aumix -v0 fi It's a little naive, but it works for me (TM). I'm sure much more sophist- icated and robust solutions are to be found! I have also created a very simplistic play/pause/resume script which is bound to XF86AudioPlay (keycode 162 in my case): #!/bin/sh # Play/Pause/Unpause control for Xine. # Invoked from the XFCE4 keyboard shortcuts. XINE_PID=3D$(pgrep xine) if [ -f "/tmp/play_pause-${XINE_PID}" ] then rm "/tmp/play_pause-${XINE_PID}" && exec xine -S play else touch "/tmp/play_pause-${XINE_PID}" && exec xine -S pause fi Again, pretty naive, but it works here.=20 Once you have customised your .Xmodmap, you can ativate the changes by adding to your ~/.xsession or ~/.xinitrc xmodmap /path/to/your/home/.Xmodmap Obviously, the same command can be used to load your modifications without logging off. HTH Dan [1] http://gentoo-wiki.com/HOWTO_Use_Multimedia_Keys gives details for various window managers. --=20 Daniel Bye _ ASCII ribbon campaign ( ) - against HTML, vCards and X - proprietary attachments in e-mail / \ --AqsLC8rIMeq19msA Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.4 (FreeBSD) iD8DBQFHc/mTixf5fBYiFmoRAig/AKDKW6KwKhRHaesvJAMwl4K9dixWXwCeNvXm ay5tAVsX90XWdXNS5DVqL/8= =zj2/ -----END PGP SIGNATURE----- --AqsLC8rIMeq19msA--