<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="/stylesheets/rss.css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>Michele Campeotto: Tag fun</title>
    <link>http://blog.micampe.it/articles/tag/fun?tag=fun</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>I'm not Winston Wolfe.</description>
    <item>
      <title>Here comes the SmackPad</title>
      <description>&lt;p&gt;You probably have seen &lt;a href="http://www.youtube.com/watch?v=6uvQTTPr9Rw"&gt;the SmackBook video&lt;/a&gt; where &lt;a href="http://blog.medallia.com/2006/05/smacbook_pro.html"&gt;a guy&lt;/a&gt; smacks his laptop to switch workspace. Too bad that only works on Macs right? Not really, my ThinkPad has a device similar to the &lt;a href="http://www.popies.net/ams/"&gt;Apple Motion Sensor&lt;/a&gt; and it runs &lt;a href="http://www.ubuntu.com"&gt;Linux&lt;/a&gt;, so it ought to be flexible and easy to tweak.&lt;/p&gt;

&lt;p&gt;Well, I&amp;#8217;m happy to announce that you can smack your laptop too!&lt;/p&gt;

&lt;p&gt;Requirements:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A ThinkPad with the &lt;a href="http://thinkwiki.org/wiki/Active_Protection_System"&gt;IBM Active Protection System&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;The &lt;a href="http://thinkwiki.org/wiki/HDAPS"&gt;hdaps&lt;/a&gt; kernel module (if &lt;code&gt;sudo modprobe hdaps&lt;/code&gt; fails, you&amp;#8217;re not qualified)&lt;/li&gt;
&lt;li&gt;The &lt;code&gt;wnck&lt;/code&gt; Python module, provided by &lt;code&gt;gnome-python&lt;/code&gt; (if &lt;code&gt;python -c "import wnck"&lt;/code&gt; fails, you&amp;#8217;re not qualified either)&lt;/li&gt;
&lt;li&gt;An &lt;a href="http://www.freedesktop.org/wiki/Standards_2fwm_2dspec"&gt;EWMH&lt;/a&gt; compliant window manager (most modern WMs are)&lt;/li&gt;
&lt;li&gt;The &lt;a href="http://micampe.it/files/smack.py"&gt;&lt;code&gt;smack.py&lt;/code&gt;&lt;/a&gt; script&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Run the script from a shell:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$ python smack.py
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;and smack your ThinkPad at will to change workspace back and forth.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Caveat:&lt;/em&gt; It&amp;#8217;s not really reliable: sometimes it&amp;#8217;ll switch in the wrong direction, especially if you try to rapdly switch more than once, but it&amp;#8217;a toy, I don&amp;#8217;t find it really useful.&lt;/p&gt;

&lt;p&gt;You&amp;#8217;re welcome to improve the detection algorithm. A basic setting is the &lt;code&gt;SENS&lt;/code&gt; variable at the start of the script: the higher the less sensitive the script will be and the harder you&amp;#8217;ll have to smack the laptop. Remember, ThinkPads are though, don&amp;#8217;t risk hurting yourself with too high values.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt; Francesco provided &lt;a href="http://micampe.it/files/iSmack.py"&gt;iSmack.py&lt;/a&gt; for iBooks and Powerbooks with the &lt;a href="http://www.popies.net/ams/"&gt;AMS&lt;/a&gt; driver.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Update 2:&lt;/strong&gt; &lt;a href="http://www.oakcourt.dyndns.org/~andrew/journal/?p=28"&gt;Andrew&lt;/a&gt; hacked a version that works with Compiz.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Update 3:&lt;/strong&gt; &lt;a href="http://weblogs.mozillazine.org/gerv/archives/2006/09/stablilised_smackpad.html"&gt;Gervase Markham&lt;/a&gt; has an improved version with stabilization.&lt;/p&gt;</description>
      <pubDate>Sun, 04 Jun 2006 01:54:00 -0700</pubDate>
      <guid isPermaLink="false">urn:uuid:cc9b1f25-59e7-48bb-89d2-dc85048e56b6</guid>
      <author>micampe</author>
      <link>http://blog.micampe.it/articles/2006/06/04/here-comes-the-smackpad</link>
      <category>English</category>
      <category>linux</category>
      <category>thinkpad</category>
      <category>toy</category>
      <category>fun</category>
      <trackback:ping>http://blog.micampe.it/articles/trackback/217</trackback:ping>
    </item>
  </channel>
</rss>
