From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1OlWDI-00041Z-4v for garchives@archives.gentoo.org; Wed, 18 Aug 2010 00:09:06 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id B3061E097B for ; Wed, 18 Aug 2010 00:09:03 +0000 (UTC) Received: from out1.smtp.messagingengine.com (out1.smtp.messagingengine.com [66.111.4.25]) by pigeon.gentoo.org (Postfix) with ESMTP id 7F02DE0990 for ; Tue, 17 Aug 2010 23:44:13 +0000 (UTC) Received: from compute1.internal (compute1.internal [10.202.2.41]) by gateway1.messagingengine.com (Postfix) with ESMTP id 5F8562FF for ; Tue, 17 Aug 2010 19:44:13 -0400 (EDT) Received: from frontend2.messagingengine.com ([10.202.2.161]) by compute1.internal (MEProxy); Tue, 17 Aug 2010 19:44:13 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=messagingengine.com; h=subject:from:to:in-reply-to:references:content-type:date:message-id:mime-version; s=smtpout; bh=MlPQ/Boinf5cJak7/harxpFjLIc=; b=XyThNkR//OP2PEpU0sDI3koWAn++dRgW3Y+dzh7AbvISAe6/gNW8HGQWnNHCzm7xw4LjnEeel/k0RSTpCxCmgAdFFXtQev1VrANLRAieQ2OA0SmZpVKGKUnjW1s/j6sPxTvBJJMCb7K+PQtSonZctYpqDxlTMdmirT2kknbCtmk= X-Sasl-enc: mHt4B3ablCUj/ASMJ2NpPPHquLgFerG/g5Ei/t4Vx1IN 1282088653 Received: from [192.168.31.28] (cpe-069-134-182-167.nc.res.rr.com [69.134.182.167]) by www.fastmail.fm (Postfix) with ESMTPSA id 2049A5E58DB for ; Tue, 17 Aug 2010 19:44:13 -0400 (EDT) Subject: Re: [gentoo-user] Typewriter sound From: Albert Hopkins To: gentoo-user@lists.gentoo.org In-Reply-To: <1282088517.456104.20.camel@paska> References: <20100817172005.GA5110@solfire> <1282087043.456104.6.camel@paska> <1282088517.456104.20.camel@paska> Content-Type: multipart/mixed; boundary="=-mSwr7LfsVoBK/nWG4QW8" Date: Tue, 17 Aug 2010 19:44:12 -0400 Message-ID: <1282088652.456104.21.camel@paska> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-user@lists.gentoo.org Reply-to: gentoo-user@lists.gentoo.org Mime-Version: 1.0 X-Mailer: Evolution 2.30.2 X-Archives-Salt: cfd373c0-bada-43d3-be64-b5ebc67c1fbd X-Archives-Hash: 876e5c289d30e114f7b5f9fd753c92b7 --=-mSwr7LfsVoBK/nWG4QW8 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit On Tue, 2010-08-17 at 19:41 -0400, Albert Hopkins wrote: > Here is my edit of his Python script. ... which I actually forgot to attach :| -a --=-mSwr7LfsVoBK/nWG4QW8 Content-Disposition: attachment; filename="keypress.py" Content-Type: text/x-python; name="keypress.py"; charset="UTF-8" Content-Transfer-Encoding: 7bit #!/usr/bin/env python ## A tiny, nifty script for playing musical notes on each keypress. ## ## Copyright Sayan "Riju" Chakrabarti (sayanriju) 2009 ## me[at]sayanriju[dot]co[dot]cc ## ## Released under WTFPL Version 2 ## (DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE) ## Copy of license text can be found online at ## http://sam.zoy.org/wtfpl/COPYING ## http://rants.sayanriju.co.cc/script-to-make-tick-tick-sound-on-keypress from Xlib.display import Display import subprocess import time KEYPRESSFILE = 'typewriter-key-1.wav' RETURNFILE = 'typewriter-line-break-1.wav' notes=[440,494,523,587,659,698,784] ZERO,SHIFT,ALT,CTL=[],[],[],[] ENTER = [0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] for i in range(0,32): ZERO.append(0) if i==6: SHIFT.append(4) else: SHIFT.append(0) if i==4: CTL.append(32) else: CTL.append(0) if i==8: ALT.append(1) else: ALT.append(0) ignorelist=[ZERO,ALT,SHIFT,CTL] def main(): disp = Display() # connect to display while 1: #event loop keymap = disp.query_keymap() if keymap not in ignorelist: filename = RETURNFILE if keymap == ENTER else KEYPRESSFILE subprocess.Popen(['aplay', filename], stderr=open('/dev/null', 'w')) time.sleep(0.1) if __name__ == '__main__': main() --=-mSwr7LfsVoBK/nWG4QW8--