SmackBook Pro
By Erling Ellingsen on May 22, 2006Updates below the fold
I usually keep two 20" screens side by side on my desk, so I can code
on one and test on the other. I find I can work much faster if I can
just make a change in Eclipse, and by the time I turn my head to
the other screen, the tests have already run. My new laptop, however, has a 15" screen, which feels a bit cramped when I'm
working away from the office. I've been using the fancy Desktop Manager by
Richard Wareham, which is a very nice utility to let you keep several
virtual desktops, and change between them easily.
Of course, if you're using something like Emacs or Butler, all your keys will be taken already, so you'll need to use some sort of Command-Ctrl-Shift-4 keystroke for the actual desktop switching.
Turns out, the laptop has a built-in motion sensor. Nominally, it's there to protect the internal hard drive. The basic idea is this: If the accelerometer suddenly notices that the gravitational pull of earth is no longer present, the most likely explanation is that the laptop, sensor and all, is currently accelerating at 9.81 m/s² towards said earth. In that case, it will (wisely) try to turn the hard drive off in preparation for impact.
It can, however, also be used in situations not involving lobbing the laptop across the room, fun though that may be.
7/30: And now, the "official" IBM version for ThinkPad, which lets you use "shave-and-a-haircut" as your screen-saver password.
6/29: Smack your Nokia phone
6/27: Smack the penguin: GTollina.
6/17: Less violent (light sensor based) version now out.
6/7: Tom Merritt at c|net has posted a tutorial video of sorts. Thanks!
6/5: Here comes the SmackPad - courtesy of Michele Campeotto, you can shake your IBM ThinkPad to bits too.
5/31: Lincoln Ramsay has released UniMotion, a small open source library for reading the motion sensor. It supports iBook, PowerBook and MacBook Pro, old and new. Go Lincoln!
The latest release of VirtueDesktops supports the NSRemoteNotificationCenter protocol detailed below, so steps 1-7 of Dave's illustrated instructions have been superseded by "Install VirtueDesktop."
5/26: Any OSX developers looking for a fun hacking project? CGSSetWindowWarp is still virtually unused.
If you're on a PowerBook or iBook, see comment #136. For sensitivity issues, see #152.
All code in this post is released under the GPL.
Desktop Manager patch
First, you'll need to be able to control Desktop Manager from
outside. Cocoa has a nice class called NSDistributedNotificationCenter
which can handle simple message passing between applications. DM uses
a notification center internally to send "next desktop", "previous
desktop" commands to itself, so the patch just replaces the normal
version with the distributed version. I added the following to WorkspaceController.m, inside the init method:
[[NSDistributedNotificationCenter defaultCenter] addObserver: self
selector: @selector(selectNextWorkspace)
name: NOTIFICATION_NEXTWORKSPACE
object: nil
];
[[NSDistributedNotificationCenter defaultCenter] addObserver: self
selector: @selector(selectPreviousWorkspace)
name: NOTIFICATION_PREVWORKSPACE
object: nil
];
To control all the windows in the system, an application needs to have access to
the CGSUniversalConnection; only one application can have that at a
given time, and the Dock tends to win the battle. Desktop Manager sneakily uses
mach_inject to inject its own code into the Dock
application. There's still no x86 version of the sweet, sweet mach_inject library (Wolf! Help us!), so
not all the Desktop Manager features will not work on Intel.
Reading the sensor
For the actual sensor reading, I used amstracker by Amit Singh. He does not allow redistribution, so you'll have to get it directly from the source.
notify: Remote control for Desktop Manager
This 15-line program lets you send random notifications to any running application.
#import <Foundation/Foundation.h>
int main (int argc, const char * argv[]) {
[[NSAutoreleasePool alloc] init];
if(argc != 2) {
NSLog(@"Use: %s notification-name", argv[0]);
return 1;
}
[[NSDistributedNotificationCenter defaultCenter]
postNotificationName: [NSString stringWithCString: argv[1]]
object: nil];
return 0;
}
Compile it with gcc -framework Foundation -o notify notify.m, then call it with
./notify SwitchToNextWorkspace.
Actual motion interpreter
You can do arbitrarily fancy stuff here; this 10-line Perl script
just checks to see if the horizontal acceleration exceeds some threshold in
either direction, and calls the notify program.
use strict;
my $stable;
open F,"./AMSTracker -s -u0.01 |";
while(<F>) {
my @a = /(-?\d+)/g;
print, next if @a != 3;
# we get a signed short written as two unsigned bytes
$a[0] += 256 if $a[0] < 0;
my $x = $a[1]*256 + $a[0];
if(abs($x) < 20) {
$stable++;
}
if(abs($x) > 30 && $stable > 30) {
$stable = 0;
my $foo = $x < 0 ? 'Prev' : 'Next';
system "./notify SwitchTo${foo}Workspace\n";
}
}
Summary
Here's a self-contained zip file of the above patches.- Install and run the patched DesktopManager
- Download and unzip the zip file above (I just updated it with a binary version of
notify, so you'll have to re-download it) - Download
amstrackerfrom osxbook.com (I'm not allowed to redistribute it) - Place the
amstrackerbinary in the directory where you unzipped smackbook.zip. - You should have a directory with the files
amstracker,notifyandsmack.pl. From the terminal, in that directory, run the commandperl smack.pl
TrackBack
Listed below are links to weblogs that reference SmackBook Pro:
» Smackbook from The Blog From Another Dimension
This is a cute little video showing a clever Mac Hack. Apple laptops include a hard disk motion sensor, intended to stop the hard drive whenever a sudden motion is detected; this was intended to prevent disk crash damage when a laptop was dropped or ja... [Read More]
» SmackBook from www.blogmemes.jp
MacBookをぴしゃりと打つタスクの切り替えが出来る!
Hackは下記のURL[英語]からダウンロード出来ますがインストールはちょっと難しそうです。
http://blog.medallia.com/smack [Read More]
» Smack your Apple Laptop? from semaja2's Site
This video shows a clever use of the Apple sudden motion sensor. Simply tap the side of your MacBook and the desktop switches. Sadly, the URL at the beginning of the video is password protected. Here’s hoping somone releases the code. [Read More]
» smacbook pro from Andrew Prendergast
From dave: > Now THIS is cool and one very good reason for owning a Mac : > > Whack ya Mac! > > Watch the video. >... [Read More]
» SmackBook Pro? from russ@isitaboat
Very cool use of the inbuilt motion detector on a Mac Book Pro. Its normally designed to stop the hard-disc incase of the laptop falling - which helps save extensive damage.
In this case, its used to switch between multiple desktops! Pretty cool - c... [Read More]
» SmackBook Pro from Stone's Blog
Virtue の仮想デスクトップと,振動センサーを使ったMacSaver の話題から,このアイデアは自分でも思いつきたかった. SmackBook Pro しかし,デスクトップが切り替わるときってハードディスク [Read More]
» Smack Your Mac Up from The Osesm Report
I've always been a proponent of physical reinforcement. Why do I have to use a key combination to switch virtual screens? Why can't I just give it a sweet love tap, like the e-bully I am. Erling Ellingsen posted a way for me to command my Mac like the cow [Read More]
» MacBookでモーションセンサーを使ったツール from BUZZ LIVEYEAR
Via 秋元@サイボウズ研究所プログラマーBlog ノートブックを落としたと... [Read More]
» "Smackbook Pro" switch desktops by touch from Lifehacker
Mac user and developer Erling Ellingsen is putting the new Macbook's motion sensor to work with his virtual desktop manager. He can switch desktops by hitting the side of his "Smackbook Pro." Check out the video to see it in... [Read More]
» How to make your own Apple SmackBook from
Did you like the SmackBook Pro video from the other day? Here's how to make your own...enjoy! [Read More]
» The Smackbook from Paul Venezia
If you have a MacBook or PowerBook with the embedded motion sensor, you have to see Erling Ellingsen's SmackBook. Desktop paging with a tap of the hand; so very cool. I normally see things like this and appreciate the inventive... [Read More]
» SmackBook Pro from Gizmodo
I gotta admit, the MacBook Lightsabre was pretty cool, but the SmackBook is even cooler, and actually useful. This latest little mod utilizes the motion sensor to swap between desktops on the MacBook. The sensor was originally included in the... [Read More]
» The Smackbook from Paul Venezia
If you have a MacBook or PowerBook with the embedded motion sensor, you have to see Erling Ellingsen's SmackBook. Desktop paging with a tap of the hand; so very cool. I normally see things like this and appreciate the inventive... [Read More]
» 精密機器です。叩かないでください。 from Diary::Weblog
最近、妙にアップルのラップトップに採用されている緊急モーションセンサ技術を利用したソフトが多いような気がします。 つい先日もMacをライトセーバーにできるMacSaber 1.0 Betaなんてい... [Read More]
» The SmackBook Pro from evolvefuel
An interesting use of the MacBook Sudden Motion Sensor to switch desktops. (via TUAW)
Update: The Medallia Blog just released the source code, you can follow their instructions here.
... [Read More]
» MacBook HD Accelerometer + Window Manager = Great Hack from Josh's Weblog
While this hack is currently available for MacBooks, I wouldn't be surprised to see someone implementing the idea in Linux or Windows. It's a cute trick to use the accelerometer used to protect laptop hard drives from sudden movement as... [Read More]
» Physical Interfaces from Sacrificial Rabbit
Even if you aren't really into comptuers and assorted geekery, you must check this out: Smacbook Pro. This is by far one of the coolest, most intuitive human - computer interfaces I have seen in a long time.
I want one that when I smash the desk in fu [Read More]
» Smack you Mac up .. from c0t0d0s0.org
Ich koennte heulen ... ich moechte auch einen ein Powerbook mit Sudden Motion Sensor. Denn damit lassen sich so praktische Dinge, wie dieser aeusserst intuitiv bedienbare Desktopumschalter realisieren. [Read More]
» バシッと叩いてタスク変換:SmackBook Pro from Long Tail World
Did you know it was a Japanese Mac blogger 'mo' that first succeeded in Fast OS switching within 3 days after the purchase of black MacBook and uploaded its video to here on YouTube? Shiro was all excited about this news! (maclalalaweblog). Well, thi... [Read More]
» 【デモ動画】MacBookの仮想ディスクトップをモーションコントロールで切り替え from YappoLogs
VirtueDesktopsとParallelsを入れてわーい^^わーい^^してたら。 SmackBook Proというのを発見した。 でもこれは、他の仮想ディスクトップソフト使ってるし、パッチ当てなきゃいけないのでめ... [Read More]
» Mehrere Desktops from PFUY!!!
Irgendwo hatte ich in der New York Times mal gelesen, dass die Arbeit mit mehreren Bildschirmen die Produktivität um 30% steigert. Ich kann das für meine Fälle auf jeden Fall bestätigen. Das nervige Fenster wechseln macht es zum Beispiel unheimlich... [Read More]
» SmackBook Pro from WizbangTech
Code and instructions on how to make this work on any PowerBook or MacBook with the built-in motion sensor at Medallia Blog.... [Read More]
» SmackBook from Stefan Tilkov's Random Stuff
An even cooler use of the MacBook Pro’s built-in motion sensor: SmackBook Pro. I’m no virtual desktop fan, but I’m tempted to install this just for the Wow! factor.... [Read More]
» Frappez votre MacBook from Just for fun !
Erling Ellingsen est un dveloppeur qui a l'habitude de travailler avec du multi-cran.
Or, sur un portable, le multi cran est oublier, pour cause de "portabilit" justement ! Quoi que...
Son MacBook est quip de la technologie Sudden... [Read More]
» Two great ways to destroy your MacBook from blog^2
Motion-activated virtual desktops Turn your laptop into a light saber (sound machine)... [Read More]
» Get your own SmackBook Pro from Jon Baer
I tried the Desktop Manager and Expose Smackbook hacks on my wife's MacBook today, a very cool use for the built in motion sensor. They need to make one for Windows so you can make your reboot experience better [Read More]
» SmackBook Pro from O'Grady's PowerPage
This you've just got to see: I usually keep two 20" screens side by side on my desk, so I can code on one and test on the other. I find I can work much faster if I can... [Read More]
» Can your wintel box do this ? from david.olrik.dk
All new *Books from Apple has a build in motion sensor that is there protect the harddrive for harm, should you descide to hurl your *Book through the room. Some clever guys wrote a piece of software that that allows you to use the sensor to perform actio [Read More]
» Can your wintel box do this ? from david.olrik.dk
All new *Books from Apple has a build in motion sensor that is there protect the harddrive for harm, should you descide to hurl your *Book through the room. Some clever guys wrote a piece of software that that allows you to use the sensor to perform actio [Read More]
» SmackBook Pro, où comment changer de bureau virtuel sans le clavier from Casualtek
Pour ceux qui ne connaissent pas, les bureaux virtuels sont autant de moyen de faire semblant de disposer de plusieurs écrans alors que, concrètement, on n’en a qu’un. Pratiquement, on peut disposer d’un bureau principal dans lequel... [Read More]
» SmackBook Pro from In Earshot
Adventures in computer interface design: SmackBook Pro... [Read More]
» Klopfen zum Desktopumschalten from Open Source Jahrbuch Blog
Eine innovative Technik zum Desktopumschalten wird hier vorgestellt: blog.medallia.com [Read More]
» Smack it! from mittendrin statt nur dabei
Ich dieses unglaublich coole Spielzeug für meinen Mac gefunden. Bildschirmsteuerung durch hauen... besser wird es nicht. Leider war die Steuerung nicht perfekt. Ich habe das perl-Script ein wenig modifiziert, so daß es sich an einem Zeitmittel kalibrier [Read More]
» SmackBook Pro from Abacus::blog
コンピュータの調子が悪いときに,未だに叩いて直そうとしてしまうことがあるが,どうせならひっぱたいて操作するくらいの方が健全なのかもしれない. [Read More]
» VirtueDesktops r155 released from lunatic bumblebee
Tony has released another official build of VirtueDesktops This build contains numerous enhancements and bug fixes to core functionality, but I don’t believe you’ll notice most of it. This build also incorporates a very early version of motion-based d [Read More]
» FRIST POST!!!!!! from draining the world's beer supply one pint at a time
Ran across the Smackbook hack a little while ago, and after mentioning it to my boss was inspired to modify it very slightly so instead of switching screens, it just screen locks.
Get up to leave your desk and smack your powerbook to turn on the screen... [Read More]
» Here comes the SmackPad from micampe.it
You probably have seen the SmackBook video where a guy smacks his laptop to switch workspace. Too bad that only works on Macs right? Not really, my ThinkPad has a device similar to the Apple Motion Sensor and it runs Linux, so it ought to be flexible a... [Read More]
» Smackbook for Power Book G4 from ナチュ日記。
年末に Power Book G4 を買って、まもなく発表された MacBook... [Read More]
Comments
Nice. I will definitely give this a shot.
Did you have to compile DesktopManager on PPC? No luck getting it to compile on Intel...
Has anyone figured out to implement this? And will it work with Virtue?
does anyone have step by step instructions on how to make this work or a possible installer?
thanks
ok if anyone gets to compile this for intel macs email the package to me please at j.ruiz_isenberg@mac.com, i already downloaded n accepted the terms for AMStracker
Awesome demo. But I think us non-developer types need step by step instructions on how to get this to work.
If somebody can compile it for mac intel
please mail me
Thanks
sdaudet@freesurf.fr
Would this work for G4 PowerBooks? They have motion sensors that disconnects the hard drive if it were to be dropped.
Looks awesome but need step by step instructions, most of us are not that smart. Or it would be nice if you developed an app that will do it for you, Email me if there are any updates. I have the new MacBook.
Here you go, patched and built on intel:
http://ritalin.simplylinux.org/DesktopManager-0.5.3-patched.zip
I agree with Jeff. We aren't that smart. Mac users are simple folk who need very simple instructions. Please limit clicking to one button and all that.
Maybe you can work with Richie and make an update for Desktop Manager. That'd be swell.
I'm not that good with all of these commands so could you make like an app that would install it for us, or at least some step by step instructions. BTW, I have a G4 Powerbook 15" HR Latest Revision, will this work for it?
Thanks in advance
Hey Jeff, your ZeroLink settings are wonky on the patched build you posted. ;)
has anyone gotten this to work? im stuck on the first thing in this article.
can we get some step by step guide for this?
ok im getting a bit aggravated cause when i try to compile im getting terminal to freeze when dealing with python, i tried the patched file and it wont even launch, PLEASE email me a solution or instructions at j.ruiz_isenberg@mac.com
I've updated my archive with a binary that didn't have ZeroLink enabled. Please try the new archive if you're having problems.
I'd like to get this to work too. Some easy instructions would be appreciated. thanks!
I tried the patched and compiled version from nivfreak above, but it doesn't work. Desktop Manager runs, but no motion sensed switching --- did I not figure out how to turn it on?
I'm on an intel macbook pro.
Okay cool - I can verify this works - quite well actually. I can carry it around without unintentional screen slides pretty good.
Hey. Just so you know there is a mach_inject intel version. I downloaded it a few days ago but dont remember where but if you need it let me know. Also, to enable all the features for DesktopManager or VirtueDesktops (like being able to move windows across desktops) all you have to do is add yourself to the procmod group....
To check who is in the procmod group, use the following command:
sudo niutil -readprop "/" "/groups/procmod" "users"
To add yourself to the procmod group use this command...
sudo niutil -appendprop "/" "/groups/procmod" "users" `id -un`
To remove yourself from procmod group, use the inverse command:
sudo niutil -destroyval "/" "/groups/procmod" "users" `id -un`
I also have DesktopManager 0.53 and 0.6 available as universal apps. SO if anyone would like to host all this let me know as well...
Thanks, Josh! That's one less project I need to do :-)
I'll have to look for an open source replacement for 'amstracker'. I have what I need to make one for my MBP, but that would not work with older versions of the hardware. No time today, I have to do some actual work...
"DesktopManager 0.53 and 0.6 available as universal apps"
vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
http://forum.osx86project.org/lofiversion/index.php/t12363.html
+ mach_inject hacking for 10.4.4 and up (Intel Build)
how would modify the sensivity in the perl script, im not familiar at all with perl and it just doesnt feel right on the 12 inch PB
I installed it on my PowerBook, and it must not have the same motion detector or something... Can't really control the desktop switch, with smacking...
Great app! Thanks to nivfreak for uploading a patched version of Desktop Manager. Hell if I know how to do patch an app. I am curious, though, as to whether or not I can set this to run in the background, so I don't have to keep that Terminal screen up and running all the time.
Cheers.
So, I take it none of you computer geniuses ignoring the requests for instructions can give them? Keep talking over everyone's head and we'll think you're cool.
is this bad for the computers? i would feel like a real idiot if i broke my computer by slapping it.
Working Desktop Manager UniBin url:
http://www.arenasoftware.com/grepsoft/DesktopManagerUB-0.5.3.dmg
Bob: nivfreak made a nice, working, friendly installer, but we're not allowed to post it publicly since Amit Singh does not let other people redistribute his software. We're, among other things, discussing what we can replace it with.
Given enough time, I'd like to write a plugin for DesktopManager so everything would Just Work. Unfortunately, I have to do some real actual paying-the-bills kind of work too... :-)
Pat: I wouldn't recommend using it if you're upset. In fact, I wouldn't really recommend using it at all. It's just a fun hack.
Bob, et al: I think there might not be an easy solution (on Intel machines, at least). We have to use advanced terminal commands (which I myself copy & paste from pages like this) to change system-wide security settings in order to get full functionality on OS X for Intel. In my opinion this *should* be difficult because we're reopening a security hole that was recently closed by Apple. I guess we need to be patient, but I'm not sure who will want to simplify a process that reopens a security hole.
could anyone post what version of desktop manager this guy was using? when i try to run his patch in the terminal i simply get a string of errors !!
I've asked for permission to redistribute AMSTracker. Until then, I can't post the installer I made here.
The instructions in the blog are about as clear as they can get. If you grab one of the patched desktop managers, it should be easy enough.
"If the accelerometer suddenly notices that the gravitational pull of earth is no longer present, the most likely explanation is that the laptop, sensor and all, is currently accelerating at 9.81 m/s² towards said earth"
You've got it backwards. First of all, it's an accelerometer which means it measures, you guessed it, acceleration. Which means it's measuring that 9.8 figure you've got there. What it's looking for is an explanation FOR the acceleration--it doesn't conclude that acceleration is the likely cause.
Secondly, the fact that it's falling/accelerating means that the pull of earth is very much present. Gravity makes things fall. If "the gravitational pull of earth is no longer present" then nothing would fall to earth in this way.
I think what you mean to refer to is the normal force of something (table, floor, lap, etc) which acts opposite gravity and keeps the notebook from falling. Lack of this, and not gravity, is indicated by a reading on the accelerometer. Gravitational pull is more or less constant whether falling or sitting on a table.
nivfreak
cheers for the reply, however, im running on a 17" 1.67ghz machine. its still PPC, not intel. all compiled ver. are intel!
Can someone post either the patched G4 version of DesktopManager or how to run the patch? Sorry if it seems like an elementary question.
Try the universal binary in comment #34.
That version (from comment #34) doesn't seem to be the patched one, or at least it doesn't work for me.
umm tried dling that one, tried to run the patch, patch didnt work...in the end, still not up n running *perplexed* any help is greatly appreciated!
btw, Nik, i think we're in the same boat here lol.
How about using motion.c i use it in MultiAlarm and i can easily show you how to implement it into your program
semaja2: That's the plan. I just have to do some Actual Work first.
Do you have a version that works with both the 8-bit and 16-bit motion sensors? I found a IOI2C version of motion.c and hacked SMCMotionSensor support onto that. I tried googling for SMCMotionSensor but found... little.
how do you compile DesktopManager? I couldn't find a makefile? What commands do you issue to compile it???
Nice idea, but too geeky, I feel like I will never get laid again like the guy in the video if I install that patch.
Please post a working link to a patched version of Desktop Manager for PPC/UB as I can't get one to work.
Too cool
what's the little app runnign which seems to be a window full of water droplets or balls or something that responds when moved around?
Thank you for the clearly detailed instructions. I was able to get it to work without any hassle however my motion sensor does not appear to be as good as yours. I have the newest rev iBook G4. There does not appear to be any consistent value change from AMSTracker so I cannot have a consistent desktop change.
49/stef: you use xcodebuild, which is the Different Make. Or just use the shiny Xcode gui.
50/machodude: thanks for sharing
51/Obi: nice friendly installer forthcoming; check back in a couple of days
53/iain: Another toy project. Tune in next week :-)
54/bhanson: Try removing "$a[1]*256" from the perl script -- that is a workaround for a bug in amstracker, but I don't think that bug is present in the iBook version (amstracker on MBP will report lobyte(x), hibyte(x), lobyte(y) instead of x,y,z)
55/josh: "let's stock up on replacement hinges"
Thanks, hope it turns out great.
The UB-DM at #34 doesnt seem to work at my powerbook g4.
Cant we mail a working version to each other?
I tried the UniBin file #34 on my MacBok Pro, but it does not seem to work as advertised ... The desktop manager works fine, but no "SmackBook" capability is working.
Am I missing something?
Fixed it, works *pretty* good.
@56 and all: I needed to re-calibrate the smack.pl script, specifically the thresholds, that was all.
Why don't you use c0re in motion (http://blogs.23.nu/c0re/stories/7894/)?
Great stuff, im a totaly noob when it comes to this kinda thing but got it working great, used the patched intel version for my macbook pro and it works fine. I have to hit it quite hard for it to work though, is it possible to adjust the sensitivity somehow?
at #56
After removing "$a[1]*256" the sensitivity still isn't great, any tips because i don't know any perl... :)
I have the lastest iBook g4 btw.
Any reason Desktop Manager is used rather than Virtue?
Have it installed but not patching. Do you need to run the gcc script or just the smack.pl? The instructions seem to be saying the the smack perl completes everything. I don't feel like downloading XCoce 951MB to do something I don't need.
Erling,
This is so cool. I modified your motion interpreter script to trigger Expose. You can find it here:
http://jepstone.net/blog/?p=528
- Brian
wow that is actually very cool :o unfortunatly i dont have any fancy macbooks but i wonder if i could make somthing that hooked up to the serial port or usb port of my pc and could be attached to the monitor or somthing...
hey, het lukt me voor geen meter! is dit nep?
Hi!
I am trying to build Desktop Manager with XCode, with the patch applied, but it gives me the following error: "undefined compiler specification com.apple.compilers.gcc.4_0; specification may be missing or target may be misconfigured". What am I missing? Thanks for the help, I am no good at XCoding...
So cool.... My MacBook is currently in the process of being shipped so this is /definitely/ something to play with after porting DM.
Heya, why not use Virtue Desktop as opposed to Desktop Manager? It's basically what Desktop Manager has become, and it's univ. binary.
http://www.macupdate.com/info.php/id/16530
is there anyway we can get some kind of install for us non-coders? I would love to be able to do this, just don't have any background with coding.
How do you patch the Desktop Manager or where can I download a patched version for PPC? I can't figure it out.
Thanks.
For everyone asking for directions without coding - go read the instructions given in the comments. It requires one simple terminal command. That's it.
About hinge replacements: you can tap anywhere on the notebook to trigger a change, the sides near the front, on top of the palm rest, etc.
About the comment on gravity - relative to the sensor, if the laptop is falling at terminal velocity then gravity is no longer present. In other words, the only time you don't feel the effects of gravity is when you're falling. Relative to yourself, you're weightless. This is why they film space scenes for movies in airplanes flying straight down.
Of course, if your notebook is falling at terminal velocity, no hard drive parking feature is going to help it survive.
Alright, let's try this again. This package should work for both PPC/Intel users (Universal binary)
This does NOT include AMSTracker. You still have to download it, and put it in your path (e.g. /usr/bin/)
SmackBook will just keep bouncing in the dock, but it should work anyway. You'll also have to kill AMSTracker by hand.
http://ritalin.simplylinux.org/SmackBook-0_1a.zip
I'll fix the couple of gotchas above when I have a chance.
First off, a big thanks to the people who've submitted installers, patches, etc. God knows more're on the way...
As for sensitivity - I'm not familiar with perl, but just to let similar users know, here are the settings I use to make the triggering process less...violent on my MacBook Pro:
-------------
I change the 'stable' number to 60:
if(abs($x)
...
And the conditional numbers both to 30:
if(abs($x) > 30 && $stable > 40) {
---------
As simple as this is, I haven't puzzled out exactly what all this means yet. Either way, it definately makes it USEABLY sensitive, as seen in the video - at least on my MacBook Pro.
Kudos to everyone, and can't wait to see where this is headed!
how do i put amstracker in my path? If i have the installer on my desktop where should i put the amstracker in order for this to work.
Grr. Oops, should've edited. Looks like one line became an HTML tag...one more time:
----------
I change the 'stable' number to 60:
if(abs($x) > 60) {
And the conditional numbers both to 30:
if(abs($x) > 30 && $stable > 30) {
----------
For anyone truly lost, just edit smack.pl in a text editor and save. :P
Viva sensitivite!
What Amit in comment 78 said. I am confused.
I agree, where is my path? I cannot find "/usr/bin".
For those who're stuck on step one:
1. Download the patched installer (I'm not gonna tell you which one, as some say it works and some not, but I'm using the one ala comment #14)
2. Put that in your Applications folder.
3. Start it up.
4. Download Amstracker, ala top of the page (original instructions)
5. Re-read original instructions, but here ya go again:
a)put the contents of smackbook.zip in a folder, any folder - preferably one to which you have access and priveledges :D. Mines in ~/Smackbook.
b)put the contents of the amstracker download into the same directory (~/Smackbook in my case)
c) Go to terminal, navigate to ~/Smackbook, and type: perl smack.pl
d) Smack your book.
6. If it seems to happen irregularly, or only when you physically MOVE the laptop, check out my directions in the last couple of posts for adjusting the sensitivity. If it's not happening at all...I dunno. Worked for me. :P
Just so nothing's ambiguous:
In step 1 I'm referring to the patched Desktop Manager installer in #14. Put THAT in your Applications. Everything else goes anywhere you want, as long as it's all together. Also, keep in mind that you have to keep the terminal window opened (or hidden, whatever) for this to work.
I also missed the step where you download Smackbook.zip. I assume you've gotten that far. :P
The problem I have is that the patched version of Desktop Manager posted seems to be intel only.
@ comment 84: Alright, great, but how do I patch Desktop Manager on PPC? I can't use the Intel compiled Desktop Manager that nivfreak posted.
@comment 85/86: Sorry I don't have the answer to that one ... I'll defer to the experts ...
And here's an interesting quirk. Since you can now change desktops without using mouse or keyboard input, you can have a screensaver enabled on on desktop and navigate to another without upsetting it. You can even use the keyboard, etc and the saver will still be running on the other desktop. The only caveat is that since only 1 instance of the saver will run at a time, you WON'T get one on your alternate desktop. Still coo', though.
@comment 85/86: Does the file from #34 work instead of what I had linked to: http://www.arenasoftware.com/grepsoft/DesktopManagerUB-0.5.3.dmg
Well, everything works from the application's point of view at this point, I think I have a problem with my motion sensor.
I noticed the problem because after running smack.pl my powerbook just kept rapidly switching desktops from left to right until I killed the program. After running
./AMSTracker -u 0.1
I found that when completely level, my powerbook reports between -3 to -5 on the X-axis. In other words, it seems to be miscalibrated(lifting the right of the powerbook about 2 inches gives a more stablized zero.
So my question is: Does anyone know how to recalibrate or reset the motion sensor, and if not... would it be possible to define a shifted threshold within the perl script?
@comment89 - Nope. Terminal just says Simulating AMS hardware in sorftware but nothing happens when I hit my powerbook.
The zip I attached above includes universal binaries for notify and Desktop Manager (patched).
Just download the installer, run it, and then make sure AMSTracker is in your path (copy it to /usr/bin inside terminal)
nivfreak, I've done as you said but I've got two problems:
1.)Nothing happens at all when I run this version of DM.
2.)I don't use the terminal and so I don't know how to copy to this location.
Thanks
@comment 91: Does the desktop manager work at all ... even without the smack.pl running?
@comment 94: Yes, the version I was using in 91 ran fine (and exactly the same) with or without smack.pl running.
@comment 91: Neil, the mesage you receive "simulating hardware in software" ... I'm thinking your powerbook doesn't have a motion sensor ... hence the "simulating in software".
This is a different message than I get ... my message says "AMS hardware present and initialized" ...
I do have the motion sensor, I've played a bit with AMSTracker and AMS2HID already so I'm sure of that. I was getting the intialized message too don't know what was different that time.
@comment 92: The desktop manager in your package starts and then crashes. If I try to launch it seperately, it does the same thing.
@comment 97: Neil, try the file from post #77 instead of the link I originally posted in my tutorial for the SmackBook code ... yes my link in up to date as well ...
Thanks nivfreak!
@ nivfreak
Hi-Res PowerBook G4 1.67 GHz
The Desktop Manager app that gets installed by your .mpkg does not open. Not sure if this is normal, though I would expect not. I do have AMSTracker in /usr/bin. I do appreciate all the work you guys are doing trying to get this to work for the less tech-savvy among us.
Erling- nice work,
I took your base idea, and created a perl script and stuartup item with some more custom options, as well as independence for desktop switchers:
http://www.eastrain.com/ams_switch.zip
AMStracker still is needed to be put in the startupitem before installation FYI.
This was built and tested on a 12" 1.5GHz, but others may want to change the sensitivity.
Based on the concept that this should not be used except on a table, or other stable, level surface (I had a version at one point that worked on the principle of tilting the laptop, but this was near useless except on one leg while sitting...), I proceeded to change stable to become 0 the instant the laptop is titlted at all in either x or y, thus preventing a count except when perfectly level for the set interval. I also added an offset value to tweak for levelness for those of us with not-so-flat sensors. I found that by using a fractional value, fluctuating values detected by the ams sensor as it rounds can also be accounted for.
I removed the need to use notify, although it does perform spectacuarily with your patches. Instead, I make use of applescript to call key codes to trigger the switcher, as one normally would. This is also very easy to customize, as keycodes can be obtained from many utilities (notably Ukelele).
I also added a counter system to keep track of the number of desktops switching between.
One could take this script and remove the limiter, change the applescript to call itunes track and volume changes, safari navigation.... whatever...
Great inspiration, and hopefully we don't all scratch the hell out of our drives....
-dan forsythe
defor@mac.com
@comment 91: The same thing (AMSTracker reporting that it's simulating AMS hardware in software) also happened on my PowerBook 12" after a while. It seems like something regarding I2C is messed up (a few lines with warnings are written into /var/log/system.log every second), rebooting seems to help. Seems like AMSTracker triggers some kernel bug..?
I've also got problems (like many others with powerbooks?), that tapping doesn't trigger anything. When calling AMSTracker directly, the x-values only show -1 or 0, and tapping/smacking the pbook on any side doesn't really give any change in this value. Tilting it is the only thing which actually gives a noticable change in the values.
@90: I'm experiencing the same switch-back-and-forth issue on my 15" PB. Unlike yours, however, mine does not show the x or y axis as being more than 1 degree off, however. If I bump the thresholds in smack.pl up, the switching occurs less frequently, but it still occurs. I'm going to continue playing with it to see what I can figure out.
Works great on my new MacBook, thanks!
It doesn't always get the direction correct, so I'll have to twiddle the values a little... an interim solution is to just only use two desktops so that it doesn't matter.
I got it to work on my MBP no problem. 2 things though.
1. When I open the smack.pl in terminal, it loads successfully. But how do I close terminal and keep it loaded? Whenever I close it says "Closing this window will terminate the following processes inside it: login, bash, perl, AMSTracker" and the smack feature no longer works. I have to reload it. Is there a close command?
2. My sensitivity seems to be too high. I can smack the side and it changes no problem. But if I move the computer too much it changes as well. Kinda annoying for the screen to just keep switching without me doing anything but moving.
Other than that, awesome job.
None of the PPC DM installers are patched. I have gone from Terminal telling me AMS was running in hardware to simulated in software. Yes I have the sensor. Someone please post a patched DM verified to work.
For me it also seems that AMSTracker causes something to go wrong. I have the carpenter's level widget and this stops working after AMSTracker has been run.
I got the "AMS hardware present and initialized" message the first two times I ran it, but now I'm getting the "'Simulating' AMS hardware in software" message.
Also, "notify" works for me, but smacking did not, even when AMSTracker properly initialized.
I'll try again after a reboot. We'll see if AMSTracker recognizes the hardware again.
Uh....guys....
When the accelerometer sees the bump it will rush to park the drive heads to prevent a head crash. A few love taps may not cause disk problems, but if you make a habit of nudging your macbook you will eventually cause a drive failure from all that excess head motion.
@comment 101
Attempting to get your script working because I suffer from a miscalibrated AMS. How do I link this to my desktop manager? Not sure where the system event next_key and prev_key are going.
I got everything right, but just one question. When you smack to windows.. what r you running on the other part? Parallel Workstation? Becos I tried to do so, but Parallel Workstation doesn't give me a good, actual & full resolution...
Ok, Amit gave me permission to redistribute AMSTracker.
We now have a package you can just install and use, it includes AMSTracker.
http://ritalin.simplylinux.org/SmackBook-0_2a.zip
Same couple bugs as before, I'll fix them as soon as I get a chance.
Great! Now if Desktop Manager will just not crash, we'll be all set. Thanks for the great work so far.
I don't have a PPC machine to test with until I steal my wife's powerbook.
I'll look into the desktop manager issues with PPC tonight.
Fantastic, I'll keep checking for updates later tonight.
~/smackbook]$ perl smack.pl
using built-in minimum update interval (0.100000 s)
AMS hardware present and initialized
failed (error e00002c7)
It repeatedly gives me that 'failed' message.
I've downloaded the DesktopManager source, patched it and compiled it using XCode. It runs just fine. I've got AMStracker in the same ~/smackbook/ dir and I've re-downloaded the smackbook files just to make sure I'm not crazy.
I'm on a 17-inch 10.4.6 Aluminum PB (PPC), but it hates me. My AMS visual tool verifies that AMStracker is functioning perfectly.
I'm at a loss and would love to get this working. Hope someone has some advice. I'm so close, I know it.
I got it to work, and it's fantastic.
Though here's a question: does anyone know how to get it to work to bump to a fullscreen Windows running on one of the desktops via parallels? Right now when I try it, it de-fullscreens and moves it to the destination desktop.
for me the everything seems to be working fine but nothing happens when the notify command is called, i have tried calling ./notify SwitchToNextWorkspace myself from the terminal and it doesn't do anything.
works great for me..
sensivity isn't that great
sometimes it switches into the wrong direction
but that's bearable :)
great work!
I had been requested to post further information on installing my heavily modified StartupItem:
NOTE: A newer version has been posted, so if you are using the previous, please update (support for stopping the service added - was causing Finder restart lockups)
1) Download the core file from here:
http://www.eastrain.com/ams_switch.zip
2) Unzip to a folder (Safari will do this for you)
3) Download AMSTracker from here:
http://www.osxbook.com/software/sms/amstracker/
4) Mount the AMSTracker Disk Image and copy "AMSTracker" to the folder "ams_switch" from step 2.
4b) To configure your settings, open the file "ams_switch.pl" in your favorite editor. Open AMSVisualizer:
http://www.osxbook.com/software/sms/amsvisualizer/
While your system is on a level surface, edit lines 6, 7, 9, 10 in the "ams_switch.pl" to match the settings at rest. Save and exit both.
5) Move the folder "ams_switch" to /Library/StartupItems/
Finder will ask you to authenticate to allow proper installation.
6) Install your desktop switcher application and set it to start at login. I am using the 0.5.3 build of Desktop Manager mentioned in this article earlier, and recommend it due to the ease of setup and no need to change default command keys or number of desktops:
http://desktopmanager.berlios.de/
7) Restart.
On login, you will be presented with the error:
An item in the Startup Items folder ("/Library/StartupItems/ams_switch") does not have the proper security settings.
Using this item may cause problems. If you trust this item and want to fix the security settings, click Fix. To always prevent this item from being used, click Disable. To skip using this item and show this message again, click Decide Later.
Click "Fix", then "Restart"
8) On login, you should be able to control the switching while on a level surface. If not, try tweaking the x_range value.
9) Good luck!
Let me know any insights, etc.
-dan Forsythe
defor@mac.com
The new official installer corrupts installation of DM 0.53 for PPC so still can't see any results yet.
For anyone with a Thinkpad running Linux (my whole department, at least), you can accomplish the same thing using the Linux HDAPS. http://www.thinkwiki.org/wiki/HDAPS
Superb, works perfectly on my 17" MacBook Pro!!
I've written an applescript to load the smack/pl through terminal on login, smack happy!!
Here's the applescript if anybody wants it:
tell application "Terminal"
activate
do script "cd/Applications/amstracker/; perl smack.pl"
set w to first window
set visible of w to 0
end tell
obviously, change the pth to where you have "smack.pl"
I saved the script as an application and added to login items.
I found this video demo posted by a Japanese blogger who saw SmacBookPro demo. He wrote it's not that geeky... FYI;
http://www.youtube.com/watch?v=CuGHLNqprjE
For a intel build change the follwoing code in Desktop Manager project to have the smack perl script load and run automaticlly
//Change mach_inject.c
{
//ppc_thread_state_t remoteThreadState;
i386_thread_state_t remoteThreadState;
/** @bug Stack math should be more sophisticated than this (ala redzone). */
remoteStack += stackSize / 2;
bzero( &remoteThreadState, sizeof(remoteThreadState) );
ASSERT_CAST( unsigned int, remoteCode );
remoteThreadState.eip = (unsigned int) remoteCode;//srr0
remoteThreadState.eip += threadEntryOffset;
assert( remoteThreadState.eip
ASSERT_CAST( unsigned int, remoteStack );
remoteThreadState.esp = (unsigned int) remoteStack;//r1
ASSERT_CAST( unsigned int, imageOffset );
remoteThreadState.ebx = (unsigned int) imageOffset;//r3
ASSERT_CAST( unsigned int, remoteParamBlock );
remoteThreadState.ecx = (unsigned int) remoteParamBlock;//r4
ASSERT_CAST( unsigned int, paramSize );
remoteThreadState.edx = (unsigned int) paramSize;//r5
ASSERT_CAST( unsigned int, 0xDEADBEEF );
remoteThreadState.es = (unsigned int) 0xDEADBEEF;//
//printf( "remoteCode start: %p\n", (void*) remoteCode );
//printf( "remoteCode size: %ld\n", imageSize );
//printf( "remoteCode pc: %p\n", (void*) remoteThreadState.srr0 );
//printf( "remoteCode end: %p\n", (void*) (((char*)remoteCode)+imageSize) );
fflush(0);
err = thread_create_running( remoteTask, i386_THREAD_STATE,
(thread_state_t) &remoteThreadState, i386_THREAD_STATE_COUNT,
&remoteThread );
//err = thread_create_running( remoteTask, PPC_THREAD_STATE,
// (thread_state_t) &remoteThreadState, PPC_THREAD_STATE_COUNT,
// &remoteThread );
}
//Add to DMController
- (void)awakeFromNib
{
...
[[WorkspaceController defaultController] startMotionCode];
}
//Add to WorkspaceController.m
- (void)startMotionCode;
{
NSTask *aTask = [[NSTask alloc] init];
NSMutableArray *args = [NSMutableArray array];
[args addObject:@"smack.pl"];
[aTask setCurrentDirectoryPath:[[NSBundle mainBundle] resourcePath]];
[aTask setLaunchPath:@"/usr/bin/perl"];
[aTask setArguments:args];
[aTask launch];
}
Add the the following files to the project resource folder
AMSTracker
Notiy
smack.pl
Build the app and run
I have a 12" 1Ghz PowerBook. Followed instructions from Squarejelly's site to the T.
But when I execute the smack.pl script from my terminal I get a 'Simulating AMS hardware in software' message that just stalls the terminal after that.
Desktop Manager 0.53 works perfectly well though. I have SmackBook 0_1a.
I have no clue why I can't proceed with the smacking?!!
Followed perfectly the instruction of 120... But it doesn't seem to work at all...
I have a Powerbook 12" (Feb 2006)
The installation went through fine, I tried to change values of x_range but just won't work I wonder what I did wrong...
First of all thanks to defor for this awesome solution. I only have a couple of questions left. I did everything as described and it works, but I can't control when and in which directon to switch the desktop. It seems kindof random. I tinkered with my values a little but it seems not to change anything (yeah i restarted every single time). AMSVisualizer give me the follwing values:
x: flickering between 3 and 2 (2 more dominant)
y: flickering between -1 and -2 (-1 is more dominant)
z: constant at 54
any suggestions for values?
I forgot to say that i've got the latest 12" PowerBook 1.5Ghz and running 10.4.6
Post 127, you don't have the sensor. It first came with the 1.5Ghz 12 inch.
If anyone would like some personal help with this then hit me up on irc.freenode.org #sd
Works for me using the Smackbook.dmg installer. Thanks!
I'd like to hear more information about the potential HDD impacts (e.g. if the drive actually parks)
Hey Dan - I followed your instructions but no joy on my new MacBook - am I missing something that I should do before your procedure?
I think this is awesome! I really like the effort here. Thanks!
I almost have it working with the PPC 12 inch powerbook, but i can't seem to understand smack.pl enough to tweak the thresholds. It just flips from one desktop to another on me. It slows down when i tilt it back. If there was better comments in smack.pl as far as what the settings and numbers mean, i think we could get there completely.
thanks again
Sebastian: If you're on a PowerBook or iBook, the line
my $x = $a[1]*256 + $a[0];
may need to be replaced with
my $x = $a[0];
(that was a workaround for an amstracker bug which is apparently only present on MacBook Pro)
GeniusJT: Which tutorial did you follow to get it working. I also have a Pwb 12 (1.5GHz), but can't get it to work properly though I seem to have followed correctly of post 120...
comment 136 worked for me.
But on my PB12 it is not sensitive enough... does anyone know how to set sensitivity?
Another problem: it does change desktop only in one direction.
THX for any help.
tr (comment 138):
How did you get this working on your PB12" exactly? Did you use an the installer and then modify something?
I just followed the instructions on here. Having Xcode helps a ton because Desktop Manager's sourse comes as an Xcode project. I just opened the files, inserted the code per the directions, built it and used the resultant .app package.
I had to use the tip from 136. I think tweaking sensitivity comes from
if(abs($x) > 30 && $stable > 30)
the numbers in that line. It basically sets the threshold saying that if the absolute value of $x is greater than 30 AND the stability threshold is also greater than thirty, switch desktops.
And please correct me if that interpretation is wrong.
I think this is a great idea. I also see how it could work to switch desktops both directions, but I don't think we want to hit our computers hard enough to give the sensor that enough data that it can discern direction.
Would anyone who has gotten SmackBook to work on PPC macs (I have 12" PB) be able to post the working files needed for installation?
i've a powerbook g4 (march 2005)
can u upload a full installer 'cause i'm not able to make it works!!!
Same request as 141!! Also same laptop...
Though I am currently trying to do what GeniusJT instructed (140)...
I tried to use SmackBook-0_2a on an iBook G4 with AMS, but the included version of Desktop Manager crashes immediately when I try to launch it, and (as a result?) SmackBook bounces in the dock indefinitely and cannot be force-quit.
Also, someone mentioned a calibration error on an iBook earlier. Mine reads -3/-4 0/1 57 with the iBook level, so they may all be similarly miscalibrated.
i've the same problems of whosawhatsis (144) with a powerbook g4 15" march 2005
@139: I downloaded Desktop Manager source code and updated it as described.
I would upload the modified version but I don't know where since I haven't a website.
I have this problems still to be solved:
- after 3 or 4 "perl script.pl" I just get "Simulating" AMS hardware in software" and it doesn't work anymore until I restart.
I had the problem with "Simulating AMS" after playing around with things for a while. To solve it I simply rebooted. I'm still trying to figure out calibration.
desktop manager will not load for me either on my pb12 1.5.
I had the same problems on an iBook including the Desktop Manager not loading, the Smackbook bouncing and refusing to force quit and Simulating AMS.
Could this be an alternative that works?
http://www.mactelchat.com/downloads.php?do=file&id=11
Hey, Loving what you have done here. I don't actually own a Mac myself but am gonna buy me a shiny new MacBook when I can get the funds. Just an idea about the sensitivity as some people are having problems - If you do ever make an installer that you can actually distribute why not adding a calibration script to it, make the user tap the screen either side several times to get the optimal values for each users system?
Maybe not...
Slapbook is telling me I don't have a motion sensor, probably because it is built for the MBP.
OK I got it. You have to change the lines from post 136:
Rather than this:
my $x = $a[1]*256 + $a[0];
may need to be replaced with
my $x = $a[0];
Instead change it to :
my $x = $a[1];
NOT
my $x = $a[0];
The first value in the array (at least for my on my 12 inch PB) does not prove as useful as the second value. I suppose that the second value is the actual x value.
Also, to tweak sensitivity, you want to change the number 8 in this line:
if(abs($x) > 8 && $stable > 30) {
That is the absolute value that the x axis can go before it triggers the change.
Mine is set to 8 but you can change this to your comfort level.
my smack.pl in its entirety is here:
I don't know if the formatting works here, so just use it for reference, don't copy-and-paste.
use strict;my $stable;
open F,"./AMSTracker -s -u0.01 |";
while() {
my @a = /(-?\d+)/g;
print, next if @a != 3;# we get a signed short written as two unsigned bytes
$a[0] += 256 if $a[0] my $x = $a[1];if(abs($x) $stable++;
}if(abs($x) > 8 && $stable > 30) {
$stable = 0;
my $foo = $x system "./notify SwitchTo${foo}Workspace\n";
}
}
Howdy folks,
I'm the guy responsible for "SlapBook for VirtueDesktops"
Was really inspired by Erling's work and it pulled together overnite. It has largely the same logic as SmackBook (thanks to Erling's great documentation) with a few differences:
* I used freely redistributable SMS sensor code from Christian Klein (http://blogs.23.nu/c0re/stories/7894/)
* Installer
* just one Universal Binary C program
* improved on Erling's motion detection logic a bit by including some rudimentary automatic calibration, Center of Gravity and off-the-table code.
* Prefences file to fine-tune slap detection
* Debugging mode
It's an initial release though, so there's still some fit-and-finish issues. If the feedback is good, I'll keep working on it. Just check out the Roadmap on the website for what I have in mind.
Lemme know how it works out. Just post a comment at http://www.mactelchat.com/downloads.php?do=file&id=11. :)
Keep on MacTelling!!!
P.S.
Thanks a ton to Erling for blazing the trail and coming up with such a novel application for the Mac's SMS. :)
I can get it to work on my iBook, but if I kill the smack.pl script, AMSTracker won't work anymore until I reboot. This is really annoying- does anyone know of a workaround to maybe force AMSTracker to release whatever it holds onto after it gets killed?
Hi, i have a PWB 1,67 and i want to make the same as the video !
can somebody make desktop manager working on ppc format ??
Thanks very much !!
ugh... been working on this for over an hour and still no luck. PB 1.67 here...
What a neat thing!
It works great for me!
I used the Smackbook.dmg installer on a MacBook Pro.
Sensitivity could be better - anyone know how to adjust?
Now everyone just wants to know why i keep smacking my computer.
Thanks Erling! Good job!
Ok, I got it working on my iBook.
I used $a[0] and a value of "6", so the two lines would be:
my $x = $a[0];
and
if(abs($x) > 6 && $stable > 30)
AMSTracker is closed source. There is an open source alternative called Motion. Actually, there's several versions of Motion, depending on which machine you have. I recently combined the various versions into a single package and added autodetection. I've called the result UniMotion and once I've sorted out licensing issues (the combined code has 4 authors), it will be available from my site. It should be a suitable replacement for AMStracker (but better because you'll be able to include it directly in your project).
if anyone has gotten this to work on a 1.67 PB... PLEASE post instructions on how you did it! i swear i've tried every solution possible!
I just noticed if you close Desktop Manager and open Camino with several open tabs, you can use it to switch tabs as well. Maybe this tool can be even more expandable...
160/a«rand()»: Excellent! Let us know when you can release it!
You might consider making it parameterizable. I think what differs from version to version are the device name (IOI2C/AMC/PSU/BBQMotionSensor"), a command code (5, 22), the size of the buffer, and the size of the values (8 or 16 bit).
That way, we could just add command line parameters when the 50" BigMacBook is released. Also, I don't think people can copyright the API, so you won't need to contact all five authors.
I have 'partially' working on my PowerBook 17" 1.67Ghz Revision 7.
The patch provided works ok (./notify SwitchToNextWorkspace works) but the problem is in the AMSTracker program provided. There is an unfixed bug which seems to be affecting anything Max OS X 10.4.3 and over. If you cold reboot, it seems to work for a while but if you run the AMSTracker program (whick smack.pl certainly does) and then quit it, it stops working again - see comment #155). No idea on how to fix this until we get a replacement for AMSTracker. I have tried AMSTracker v0.31 and v0.34
does any one have a solution to comment 117? thanks
http://blog.medallia.com/2006/05/smacbook_pro.html#comment-117
Can it be done in Pc with your regular monitors??? please post is someone knows how...
I'm stumped I've tried every method here and can't get it working. Running latest OS X on a MacBook Pro. Can't figure out what I'm doing wrong and I'm sure having me under the hood of this thing will eventually kill it without help. Anyone got time to play email tag with me and help me out? Or if anyone has access to AIM use JasonWilsonTEM.
This is an awesome technique, I'd love to get it to work.
About the potential harddrive impact -
I'm not going to claim to know this for sure, but I'd put my money on the fact that (seeing as how the motion sensor works on a continuum and is EXTRAORDINARILY sensitive at its highest settings) a certain threshold must be met before the disk head is withdrawn.
As sensitive as the thing is, if it secured the head every time it detected ANYTHING, it'd wear out on its own anyway. At least on my new MacBook Pro, the slightest touch registers with the sensor.
That being said, as long as you've got your sensitivity to a level where you're not *literally* beating your multi-thousand-dollar computer like a redheaded stepchild, I sincerely doubt that it's withdrawing the head every time it detects motion.
Again, if it did, then it would be similarly withdrawn every time you shifted with it on your lap, every time you tapped a key too hard, every time a door slammed, every time you coughed, etc...because it DOES detect all of the above, on some level. If this was the case, the disks'd die from overuse without any intervention on OUR part.
I'm absolutely amazed at how demanding people are of total strangers whose *clearly experimental* code they are (hopelessly) trying to get working.
Can we have a uploaded version of the Desktop tool, because i cant make the ./notify tool to switch deskstops
I managed to adapt motion to work on my PowerBook 17". (I don't mind giving the code out but apparently there are some licensing issues - so if someone else would like to resolve them - or tell me how to - I'll be happy to share the code). HOWEVER, be forewarned - although the code works better than AMSTracker, it also breaks after a few runs (not after the first try like AMSTracker). Not sure if its because of faulty code in motion or my terrible C programming skills (I guessing its the latter).
I am not a novice, however I am trying to find the code-lines you describe to get this working on a 12" pb...where is the lines posted after comment 136... I dont see "my" anywhere in the ams_switch.pl file
what file are ya'll editing
Using an iBook G4, I've followed Dan's instructions from post 120, but can't figure out how to get Desktop Manager to run at startup. (I'm runing an unmodified version, should I have patched it?)
Also, I never got the warning about security issues on the ams_switch when I restarted.
Thanks to all for the great tips! (although an iBook installer for lazy folk like me would be appreciated, but I do realize all of this is done for free in spare time, so thanks again!)
@172: my is called in smack.pl to define variables/strings in perl.
One would think that this concept could be used to detect rotation.
Turn your motion-sensor equipped PowerBook/MacBook on it's side and the screen rotaes like the old Radius Pivot displays.
I wonder.
It took some tweaking, but after about an hour I got this working great. I just hope no one hits my desk too hard while I'm working, a jolt to the desk sends my desktop flying away :(
Great idea though, and for just your spare time... really fantastic, thank you.
To address some issues before i sign out of this topic for a while:
> 173:
> Using an iBook G4, I've followed Dan's instructions from post 120, but can't
> figure out how to get Desktop Manager to run at startup. (I'm runing an
> unmodified version, should I have patched it?)
> Also, I never got the warning about security issues on the ams_switch when I restarted.
My version si designed for workign with the unpatched version. To get it to run at startup, I should have said at login...
Use the Accounts pane in Preferences and choose "Login Items" for a user, add the Desktop Manager application.
The security issue *SHOULD* go away when you choose "Fix" on the error dialog, then authenticate, then restart...
-Hope this helps.
>On May 25, 2006, at 10:53 PM, James Hallen wrote:
>Hey,
> I'm trying to get this installed and I'm fairly certain I used your directions
> to a tee. Everything seemed to install and configure fine. But
> it wont switch to the next desktop with a simple "smack."
> I'm trying this on a MacBook (that could be the problem right
> there I suppose.) But if you have any idea(s), it would be greatly appreciated.
My guess is in the values needed to trigger it.
I am assuming you have customized the values for x_fix, y_fix, and x_error, y_error to match what you see in amsvisualizer. From there I would see what numbers you get out of an averagesmack in the x axis while in AMS Visualizer, and subtract the x_fix value from that to get the number needed for x_range.
Also, to make it need less accelleration, you might want to change the line:
open file,"./AMSTracker -s -u0.001 |";
to
open file,"./AMSTracker -s -u0.01 |";
Restart after all changes, or if you're familiar with osx startup items, restart the service "AMS Switcher"
-Dan Forsythe
FYI, after seeing my neutral point deviate by about 1-1.5 in x and y since I started debugging this, I have decided to stop develpment until I am sure I am not permanently damaging my laptop.... I would not discourage others, and I did go through some rather vigourous "smacks" earlier on...
for all of you who keep repeating "I cannot work on this because I have Actual Work to do" - I don't presume wasting hour after hour posting on a blog qualifies as "Actual Work"?
Hi,
you can find here http://www.palma.bz/files/mac/DesktopManager-0.5.3-patched.dmg
a patched version (only for ppc) of DesktopManager. It works fine on my iBook G4!
bye,
martin
Hi Martin,
Tried you patched DesktopManager, but it doesn't work. Console reports:
ZeroLink: could not load .o file: /Users/martin/Desktop/DesktopManager/build/DesktopManager.build/Desktop Manager.build/Objects-normal/ppc/DMController.ob
I think you missed something somewhere :)
Martin,
As a matter of fact, Console reports:
ZeroLink: could not load .o file: /Users/martin/Desktop/DesktopManager/build/DesktopManager.build/Desktop Manager.build/Objects-normal/ppc/main.ob
ZeroLink: could not load .o file: /Users/martin/Desktop/DesktopManager/build/DesktopManager.build/Desktop Manager.build/Objects-normal/ppc/DMApplication.ob
ZeroLink: could not load .o file: /Users/martin/Desktop/DesktopManager/build/DesktopManager.build/Desktop Manager.build/Objects-normal/ppc/NotificationView.ob
ZeroLink: could not load .o file: /Users/martin/Desktop/DesktopManager/build/DesktopManager.build/Desktop Manager.build/Objects-normal/ppc/Preferences.ob
ZeroLink: could not load .o file: /Users/martin/Desktop/DesktopManager/build/DesktopManager.build/Desktop Manager.build/Objects-normal/ppc/PreferencesController.ob
ZeroLink: could not load .o file: /Users/martin/Desktop/DesktopManager/build/DesktopManager.build/Desktop Manager.build/Objects-normal/ppc/CodeInjector.ob
ZeroLink: could not load .o file: /Users/martin/Desktop/DesktopManager/build/DesktopManager.build/Desktop Manager.build/Objects-normal/ppc/mach_inject.ob
ZeroLink: could not load .o file: /Users/martin/Desktop/DesktopManager/build/DesktopManager.build/Desktop Manager.build/Objects-normal/ppc/DMController.ob
So more files are missing.
Regards,
Sander
Hi all...
Martin forgot to change the build type, to deployment... You will find a right version here:
http://lanoix.kousai.org/smackbook.zip
(There is a readme in french, 'cause I changed the perl script so that it worked on my Powerbook G4...)
martin -
Library not loaded: /System/Library/PrivateFrameworks/ZeroLink.framework/Versions/A/ZeroLink
Referenced from: /Volumes/DesktopManager-0.5.3-patched/Desktop Manager.app/Contents/MacOS/Desktop Manager
Reason: image not found
where is the smack.pl file? all I can find is the ams_switch.pl file...
i dont know what im missing...
LANOIX THANK YOU!!! FINALLY A PPC VERSION THAT WORKS!
all those who have trouble getting it to run on a PPC machine, POST 182. IT WORKS!
JOY
i just cant seem to get any patched non-intel version working hmm...
OH, Yes, it´s really working on my PB 15" October 2005 with the Version from Post 182!!!
Thank you
And it rocks ;)
I use the "Cube" transition... I love it :)
Hi!
I can't make it work with the lanoix readme. I don't understand the step n°3.
Can somebody help me please?
hi,
sorry for that mistake! :-) It was my first programm compiled and build with the xcode tool!! So i fixed it and uploaded the new one. Now it should work!!
File: http://www.palma.bz/files/mac/DesktopManager-0.5.3-patched.dmg
bye
martin
hi martin.
is downloading your patch the only thing to do?
I have the last iBook g4 and i can't make it work. does somebody who have it on an ibook can help me?
bye
ps. if you speak french, me too
hi itom,
you can download the my patched version of DesktopManger and start it. Then follow the instruction above in the page from point 2.
If you run perl smack.pl and nothing is going on, you can simply test if the notify program work correctly if you exec ./notify SwitchToNextWorkspace in the terminal. (it should switch to a other workspace.)
bye
martin
ps. sorry I do not speak french only german,english and italian :-)
I don't know how to run a command in a directory.
I don't know how to do to run perl smack.pl
and thank you so much for your help.
iTom: tu dois ouvrir le terminal et te placer dans le dossier dézippé... Tu tapes "cd " et tu glisses le dossier dézippé sur le terminal, ca va mettre le chemin en bout de commande. ENTER, pour changer de dossier donc. Et tu tapes "perl smack.pl" ;)
-------------
For interested, my readme says:
0- add amstracker in the unzipped folder
1- start the included desktop manager
2- choose cube transition
3- open the terminal, type cd /...the unzipped folder .../ and type perl smack.pl
But it's only a little mod from this original post...
go to Application/Utilities/ and start the Terminal. Now you see something like a command prompt "username$" .
Type "cd location/where/smackbook/is" and hit enter
(e.g. for me is "cd Desktop/smackbook") and now run "perl smack.pl"
here is a howto how to use the terminal if you never used one! http://www.macdevcenter.com/pub/a/mac/2005/05/20/terminal1.html
bye,
martin
j'ai fait tout comme indiqué...
A la fin ca inscrit ams activated ou un truc du genre. Mais ca ne marche pas qd je frappe sur le coté de l'écran
I have a powerBookG4 (March2005).
It seems that I have some problem with the algorithm.
I tried to modify code as shown in 136 and 152 but the screen doesn't change. Can somebody explain the algorithm and the data that the sensor passes to the perl script?
"Simulating" AMS hardware in software
I have this text in the terminal after doing the operation but still does'nt work. is it normal?
@itom: reboot the machine! and try it than again.
it works!
thank you very much lanoix and martin.
that was very kind of you hepling me.
last question. Now it's done, will it stay like that after boot?
is it normal I have to retype the command after each boot to make it work again? And is it normal that the terminal has to be open to make it work ???
No, you must start it each time you want to use the feature.
Someone will probably do a cool app with this in the future... ;)
To answer 202 correctly: yes, because for now it's a simple process running as if you had started an app.
Using hires 15pb (1.67):
I downloaded lanoix's foler from 182, added amstracker to the folder,
BUT when I start Desktop Manager it quits after a few seconds .. am I missing something ?? (havn done anything in terminal cause dtmanager doesn seem to work)
Cheers for any info !
Worth noting that it's not necessary to whack the screen with all your might - even a slight nudge to the base of the laptop is enough.
A bit gimmicky, but a great way to waste 20 minutes on a Friday afternoon!
I'm currently working on a way to make this launch on login. Not having much luck with it as yet, when I do I'll link a download.
Cant get desktop manager to work at all actually? downloaded the original and when launchd it quits after a few seconds.
Anyone know anything about this?
15" Hi-Res PowerBook G4 1.67 GHz
-lanoix: Thank you very much for getting this to work easily on PPC! It is working beautifully now. All my Windows PC colleagues are in awe. :-D
Hi all and thank you for this nice gadget.
with #182 it works fine on my pb 15" (august 2005)
however, my temperature sensor would stop responding after slapping. checking back on the sensitivity settings.
Hmm, it doesn't work for me :(
I downloaded the patched PPC-Version and started the perl in the Terminal:
"Simulating" AMS hardware in software
But nothing happens, although I made restart…
It's a Powerbook G4 15" 1,67 GHz
Perhaps someone can help me.
Thx
I have a bit of a suggestion, someone mentioned earlier about someone bumping into their desk causing their workspace to switch -- Would it not be a good idea to switch from a single slap to a quick double tap?
This would seem to be a more useful solution to weed out possible intereference from other sources of motion. Perhaps this could even be extended to including pauses.
For instance, tap tap would switch workspaces, tap pause tap would switch tabs, tap tap tap to switch programs, tap tap pause tap, and so on and so forth.
Perhaps one could even begin to sense verticle taps on the top of the screen, to minimize applications, for instance.
(Sorry, I'm a PC user, but this is so cool, I just couldn't help but comment. Very cool hack.)
Downloaded the universal version (.6) of desktop manager : this version doesnt quit .. Is there a patched version of .6 which I could replace lanoix's with ?
I'm not even going to try until someone has an easy to use installer that will do this all for me. I have the late 2005 model of the 12" iBook.
"Simulating" AMS hardware in software
can anybody tell why is this happening/how to get around this?
I do not believe that the earlier powerbook G4's have the motion detector built in. Has anyone verified this?
Thanks
Abraham
Just confirming the version
Hardware Overview:
Machine Name: PowerBook G4 15"
Machine Model: PowerBook5,6
CPU Type: PowerPC G4 (1.2)
(From System Profiler.app)
if it helps, the PowerBook5,6 already has the two finger scrolling (and it also advertised SMS).
Uhm I think this is a big hoax. It looks like the video has been made with After Effects... nice try though ;)
It seems to me K has never owned a Mac :)
It is most likely a good idea not to try unless you are really into breaking, fixing, and programming computers.
"Simulating" AMS hardware in software means that the software cannnot get access to the AMS sensor.
When I got this error, I rebooted to fix it.
Of course, if you don't have this sensor, you will get that error as well.
Lanoix Hack works great on my 17"1,67 with sensibility set to 12 (less nervous). Desktop moves in the wrong direction: tipping left moves it to the left. Is there any button to change that?
Will be my ultimative musthave gui tool - when it works with the hatch closed ;)
K i swear, i finally got it to work and it works perfectly. Off course if you can't get it to work it's very easy to just call it a hoax instead of doubting youre capabilities.
it's a very cool hack but after playing around with it a bit i got tired of it. I still think that using the shortcut key is a lot easier than slapping my powerbook. He might just slap back ;-) although i would like to see this built-in other apps.
In "smack.pl" I reversed "Prev" and "Next", so it now moves in the "right" direction.
Indeed I think of this feature as important as two-finger-scrolling.
Really Apple-like
I can't get it to work.
- Latest PB G4 (15')
- Installed and ran Desktop Manager 0.5.3
- Downloaded and extracted smackbook.zip
- Edited .pl file, following #152
- added amstracker
- ran "perl smack.pl".
The message "AMS hardware present and initialized" appears, but nothing happens when I rock my powerbook. What's wrong? Additionally, I can't execute "desktopmanager.patch" in terminal. "No such file or directory" when typed in. I tried "sh desktopmanager.patch" but it returned an error for every line. I'd appreciate some help. =/
so you have to leave the terminal running for the entire time that you want this to work?
Yes.
For Prev & Next, I can get it working exactly as I want it. I've looked at the values provided by AMS and sometimes it's not possible to determine if I tap it right or left. (Maybe I'm too nervous lol)
I think I will only use "next" as I work with only 2 screens... :p
If I had time I would try to do a nice application with that... But it's not possible for me now :|
Okay guys this might be fun.
So I made a patch for VirtueDesktops (http://www.virtuedesktops.info) you can download in the appropriated ticket: (http://trac.virtuedesktops.info/ticket/71)
I compiled r150 with the patch. A patched VirtueDesktops version can be downloaded
!!! WARNING !!!
This is an unofficial build DO NOT complain to the authors of virtueDesktop about it!
(http://mdot.mine.nu/moritz/files/VDr150_MSPatch.dmg)
!!! WARNING !!!
It behaves exactly like the patched DesktopManager. (takes SwitchToPrevWorkspace, SwitchToNextWorkspace) Notifications.
You could use it as drop-in replacement for the DesktopManager and use all other tools/sources provided here.
I got some other issues with my PB HiRes -- the MS seems not to report consistend values when I tap my book on the right/left. Too bad :/
kindest regards,
Moritz Angermann (http://mdot.mine.nu/)
Better patent this before some dirtbag corporation does it.
@ #229 - AWESOME! I much prefer VirtueDesktops. This is great. Much appreciated.
Bonjour!
J'ai essayer la version -->182 et celle d'origine....
j'arrive a obtenire: "Simulating" AMS hardware in software
mais il ne se passe rien.... y a t'il quelquechose que j'oublie? (j'ai redemmarer ma machine)
j'ai un powerbook g4 1.5 alu...
soooooooooooooo,
it seems that on the pb15" PPC the sms is linked to the temperatur sensor, the ambient light sensor, and the illuminating the keyboard sensor.
After a fresh restart, the smacking works fine. after I smack a while, the software does is not able to contact the sms anymore. upon restarting the smack.pl, I get the known message "simluating ams.. blah blah"
according to "pmset -g" the sensor is still active, however, non of the above mentioned sensors work anymore.
A fresh restart brings everything into proper functioning again.
Is there a way to "re-initialize" the sensor, that I can get the sensors working again without a complete restart?
Does anyone know a cause of this sensor freezing?
thanks in advance
ok people, listen up!
i made a really easy version with tutorial and all files for ibooks:
http://invisiblesun.googlepages.com/SetupforSmackbook.zip
let me know if the link doesn't work and maybe someone else can host it somewhere better.
To those folks having trouble on the 5,6 15" PBs I have spent some time looking into it this morning.
For whatever reason that apple has yet to address there is an issue with a particular hardware revision of the SMS that causes it not to initialize on cold boot. It shows up in pmset -g as 1 but the computer is unable to actually communicate with the SMS. Apple has released a KB article about it.
http://docs.info.apple.com/article.html?artnum=303178
There is a lengthy thread on the apple discussion board here:
http://discussions.apple.com/thread...ssageID=1143150
The cliff's notes are this: If you do a warm boot, you'll be fine. Restart your machine and all will be well. SMS shows up in the system profiler and all the programs designed to access data from the sensor work great.
allo allo, thanks for comment 234. Your tutorial and files worked perfectly on my 12" PB.
yeah, i figured it would work on all PPC books, Brian. glad it worked.
just as an amendment to my original post: the only thing i did was give a clearer readme and put it all in one package, all the other stuff had been posted here already.
http://invisiblesun.googlepages.com/SetupforSmackbook.zip
Awesome work!
Got it to work using zip in 234 on 17" PB
one question though is there a way to get Desktop Manager to "slide in the right direction" i.e when you slap on the left it slides to the right.Make sense?
Thanks Again
hello. using a 17 powerbook. downloaded zip from 237 and terminal says its good, but smacking does nothing...suggestions?
I had to reset my SMS on my 17" PB
This is what I did:
disable sms in terminal
enable sms in terminal
to do this refer to
http://osxbook.com/book/bonus/chapter10/ams/
Then restart
jb, hitting the screen isn't as good as tapping the sides of the book itself. mine is quite sensitive, so if it's not that, i don't know.
Dave, i don't have time to check, but in that pl file, there might be a line about left and right. i'd assume changing those would do it.
Oh my heavens, it works. Kinda sensitive (it's switched accidentally when I bumped my desk), but it works (with the download @237).
cool. I gotta show my wife.
How bout a Growl that says, "Ouch!" when the MacBook is smacked?!?
Thanks Allo
it was in the pl file I swapped next and prev and all is well
A Growl addition would be cool
Hi all,
based on erling's and lanoix's work, i made out a little perl script for my ibook G4.
If you hit the right side of your computer, it switches between all the opened windows.
If you hit the left side of your computer, it launches Exposé.
Hope that it could help. You can find it here: http://morgan.1er.free.fr/divers/smackmeuh.zip
While running smackbook, my systemlog got this error.
Also, amrit's amstracker eats up a steady 6-7% of my cpu usage while it is active. This plays hell on battery usage.
From system.log:
May 25 15:57:34 /Applications/Desktop Manager.app/Contents/MacOS/Desktop Manager: The function CGSReadObjectFromCString is obsolete. Use of this function may cause an overall degradation in the performance of this application, or of the system as a whole.
post 237's zip file got every thing working great on my PBG4 12" from december. Its a little too sensitive, however im not sure how to tweak the file...hope someone could help me out here.
also, is there a way to boot all of this up at startup?
great little tool though, cant wait to show it off.
well...
I'm kinda of worried that this will DAMAGE a VERY EXPENSIVE laptop?
wouldn't you think there are some bad effects from smacking it constantly everyday?
hey,
Works very charming here, on an iBook 1.4GHz using 234!
Thanks alot, as soon as I got my MacBook pro back from repair, I will try that one too (yes, it died on me very badly.....)
Sander
hey Jeff, I wouldn't worry too much about that because even just rocking it will cause it to switch.
Jeff (249)-
I can see a lot of damaged hinges coming about.
You could try tapping firmly next to the computer.
"what?", regarding the accelerometer, the original post was more or less on-track, and you've got it entirely backwards. Keep in mind that the accelerometer is fixed to the laptop body. When the laptop is sitting on a table, the accelerometer feels a force equal to m * 9.8 m/s^2 from gravity, and the laptop itself supplies an equal force in the opposite direction to keep all of its parts stationary. this is what the accelerometer measures, so at this point it reads a bit under 10m/s^2. If, however, the machine is free-falling, then the accelerometer component and the rest of the laptop are being accelerated equally by gravity, and so the compensating force exerted by the laptop body is 0. And so that's what the instrument would measure.
Keep in mind, absolute frames of reference don't exist, and gravity and acceleration are indistinguishable.
holy crap, thanks to you guys i FINALLY got it working with lanoix's download and eRolf's reverse instructions.
thanks guys!!!! this is awesome!!! i hope someone puts this all together in an actual little app sometime. that way i don't have to keep terminal open all the time and do all the steps... :-)
thanks again!
Wow good smack book
Nice work. I found the smack detection a bit too jumpy though.
I modified the perl script to compute a running average, and compare the value to the average value for detection. It also switches off smack detection if there is too much going on (i.e. you can carry your MacBook around without switching desktops). I also used only a[0] for motion detection, but a[1] for motion classification. I have the impression what is best there highly depends on the hardware type, unfortunately (I have a MBP).
The new script is here: http://d.l.g.supersized.org/uploads/smack.pl.txt
I found for best effect, use only two Desktops, with sliding effect, and swap "Next" and "Prev" in the script. That'll make the Desktop slide away in the right direction.
Hey guys.
This sensor stuff is really driving me nuts. I tried to figure out a way to recornise "right-slap"/"left-slap" correclty. It simply seems not possible not even if i set the udate frequence extremely high.
This is on a HiRes PowerBook 15" ...
It looks like the Mac Books have a much more sensitive sensor, looking at those threshold values.
What irritates me is: I get positive AND negative start values when slapping on either side.
Yes I know the values should flow along a sine wave. But still I'd expect them to start of with eitehr positive or negative values when slapped on the right side. Not once positive once negative.
Because of that I can not figure out what side has been slapped. Making my patch to VirtueDesktop (now official in r151) for me pretty uselss :(
kindest regards,
Moritz Angermann (http://mdot.mine.nu)
Cool inventions going on lately with the SMS!
My contribution, at least imaginarily:
SMACK PINBALL
Control your pinball game by smacking your MBP gently with one finge, simulating the arcade style feeling of a real pinball game :)
I have put together a nice package for smackbook.
its got all you need for an intel macbook to run
http://eamonn.designandsolve.co.uk/Projects/462C4CE6-0DF2-4DAA-9C78-EC4C98083DB6.html
I adapter the orig perl script into a ruby script and fine tuned it. Added a stablizer so it fines the stable position point and allows you to bump it left and right even when the laptop is on weird angles... for instance when you are sitting on the couch with it on your lap.. cross legged.
#!/usr/bin/ruby
threshold = 10 # degrees of motion required to trigger
stabilizer_speed = 6 # degrees of motion the stablizer can adust to each step without triggering
sensor_speed = 0.01 # update speed of the sensor in seconds. faster is better but uses more cpu.
seconds = (1 / sensor_speed).round
wait = 1 * seconds # seconds of stable motion before a triggering
stable = 0
stable_velocity = 0
f = IO.popen('./AMSTracker -s -u ' + sensor_speed.to_s, 'r')
while line = f.gets
next unless sensor = /(-?\d+)\s+(-?\d+)\s+(-?\d+)/.match(line)
velocity = sensor[1].to_i # -128 to +128
stable_velocity += stabilizer_speed if stable_velocity
stable_velocity -= stabilizer_speed if stable_velocity > velocity
difference = velocity - stable_velocity
stable += 1 if difference.abs
if difference.abs > threshold && stable > wait
stable = 0
direction = difference > 0 ? "Prev" : "Next"
`./notify SwitchTo#{direction}Workspace\n`
end
end
Sorry. last post didnt format properly.. too quick on the draw.
This script was made for macbook pro.
So it may not work well on your others.. but It works the best out of any of the scrips i have tried yet for my MBP.
#!/usr/bin/rubythreshold = 10 # degrees of motion required to trigger
stabilizer_speed = 6 # degrees of motion the stablizer can adust to each step without triggering
sensor_speed = 0.01 # update speed of the sensor in seconds. faster is better but uses more cpu.
seconds = (1 / sensor_speed).round
wait = 1 * seconds # seconds of stable motion before a triggeringstable = 0
stable_velocity = 0f = IO.popen('./AMSTracker -s -u ' + sensor_speed.to_s, 'r')
while line = f.gets
next unless sensor = /(-?\d+)\s+(-?\d+)\s+(-?\d+)/.match(line)
velocity = sensor[1].to_i # -128 to +128stable_velocity += stabilizer_speed if stable_velocity stable_velocity -= stabilizer_speed if stable_velocity > velocity
difference = velocity - stable_velocity
stable += 1 if difference.absif difference.abs > threshold && stable > wait
stable = 0
direction = difference > 0 ? "Prev" : "Next"
`./notify SwitchTo#{direction}Workspace\n`
end
end
works great on ibook! needs to be updated so terminal ain't running! anyone?
thank you Eamonn for helping this non-programmer figure out how to do this!
I think my sms is now working. When I type ./amstracker -u 0.1 they just show samo cordinate and not changing it. But when I touch my touch pad thay reacted on that :(
What to do?
PowerBook 17" 1.67
^^^
... is NOT working...
Regarding what?'s comment..
You're being silly and overanalyzing this thing. Acceleration to the accelerometer (gravity) is only felt when the accelerometer is at a standstill, not when it is in a motion equal to gravity (falling).
Hey OniTo
AMSTracker is simulating the SMS because SMS is not active
Refer to #240 to reset your SMS
just played around with the Ruby Script (263) and it is causing it to just jump back and forth in Desktop Manager, This is also on a MBP, ran AMS Visualizer and the system isn't jumping around so unsure of the cause, but for the two times it worked it actually had better sensitivity.
nevermind found the cause, it was due to the external keyboard and the desk its on.
Hello there....
How do I to compile script 263?? applescript doesn't let me...
Comment fais-je pour faire le script n°263??
Thanks youuu
274: You don't need to compile a Ruby script. Just chmod 755 for your file and it runs. :-)
Anyway, calling the following script at the very beginning will initialize a good value of the variance, $V, and the flat location, $X, $Y. Although $X and $Y may not be very useful based on all the new hacks, I hope this can give you more fun...
# Measure mean and variance The assigment is a bit
# funny because AMSTracker doesn't work with the
# new MacBook Pro. Anyone know a hack to fix it?
sub measure
{
my ($T, $t) = @_;
my $d = dirname($0);
my $x = 0.0;
my $y = 0.0;
my $v = 0.0;
my $c = 0;
open file, "$d/AMSTracker -s -t $T -u $t 2> /dev/null |"; ;
while()
{
my @a = /(-?\d+)/g;
$x += $a[0];
$y += $a[2];
$v += $a[0]**2 + $a[2]**2;
$c ++;
}
close file;
$x /= $c;
$y /= $c;
$v = $v/$c - $x**2 - $y**2;
return (sqrt($v), $x, $y);
}
# Call meausre to initialize...
my ($V, $X, $Y) = measure(0.1, 0.001);
For example, you can use this value to see if someone is moving your computer when it is running a screen saver. It will *hopefully* avoid people stealing your MBP when you are away for a coffee...
$moving = ...; open ps, "ps -A | grep [S]creenSaver |"; my $saver = ; close ps; system $meesge if($saver && $moving);
And here is a demostration
http://www.physics.arizona.edu/~chan/temp/smack.mpg
Hi, i got a Ibook G4 and everything is working.
But if i slap my ib from the right and after that from the left, i´m not at the beginning...
it is just rushing in one direction!
Can someone help me to fix that issue??
Thx
Maxe
There seems to be some problem with AMSTracker and 10.3.9, AMSTracker just outputs "0 0 0" when running.
And typically me, I deleted an old version of AMSTracker just before I found out!
I've emailed Amit Singh about the problem. Although I guess this is just one more thing to add to my list of reasons to upgread to 10.4.
Ok. I (thanks,zyp!) got it to work with motion.c by Christian Klein (http://blogs.23.nu/c0re/stories/7894/). Although I still have to tweek the sensitivity a bit.
To use it, replace open F,"./AMSTracker -s -u0.01 |"; with open F,"while true; do ./motion; sleep 0.0001; done |";. This is a dirty fix, and should probably not be used for anything else than a bit of fun.
It worked a few minutes ago. Now, it just says,
"Simulating" AMS hardware in software
in the Terminal.
What's up with that?
Ok, I finally got it running in my PowerBook5,6 [1].
Here is what I've done:
- Read this page again and found out (via Anemia, Thank you! =) ) that the SMS in PowerBooks (PBs) won't work in a fresh boot. So, to "smack your PB" you need to boot and reboot (or otherwise have it (SMS) to run).
- Downloaded the DesktopManager source, patched it (with the patch provided in the post) and built it with XCode
- Ran the patched DesktopManager
- Downloaded AMSTracker and copied the binary to a folder.
- Tested AMSTracker and it gave me real values (not just "simulate with mouse" values). Worked like expected.
- Created the notify binary (in the same folder), as instructed in the post.
- Tested the notify with
Worked like expected../notify SwitchToNextWorkspace
- Tried the ruby script provided by Corban Brook ( Thank you! =) ) [2]. It would only work in one direction (don't remember which).
- Adapted his script to: [3]
#!/usr/bin/ruby
activation_speed = 10 # degrees of motion required to trigger
sensor_speed = 0.1 # update speed of the sensor in seconds. faster is better but uses more cpu.
cooldown_cycles = (1 / sensor_speed).round
coolingdown = 0
speed = get_next_x_speed()
while true
next_speed = get_next_x_speed() #range: -128 to +128
difference = next_speed - speed
print "Difference: "+difference.to_s+" | "
if coolingdown == 0
print "Waiting | "
if difference.abs > activation_speed
direction = difference > 0 ? "Prev" : "Next"
print " SwitchTo#{direction}Workspace\n"
`./notify SwitchTo#{direction}Workspace\n`
coolingdown = cooldown_cycles
else
print "No move.\n"
end
else
print "Cooling down:"+coolingdown.to_s+"\n"
coolingdown -= 1
end
speed = next_speed
sleep sensor_speed
end
def get_next_x_speed()
file = IO.popen('./AMSTracker', 'r')
line = file.gets
# x y z
until sensor = /(-?\d+)\s+(-?\d+)\s+(-?\d+)/.match(line)
line = file.gets
end
file.close
return sensor[1].to_i
end
- Ran the script and felt a little bit happier. =P
Thanks to all that contributed with information.
PS:
[1]: Found out via /Applications/Utilities/System Profiler.app
[2]: I chose Ruby over Perl because, to me, (hate me all you want for this) Perl is just ugly Ruby.
[3]: The print are here just for debugging. Feel free to delete them.
Kock's script gives the following error in my PB 12" 1.5 10.4
undefined method `get_next_x_speed' for main:Object (NoMethodError)
The earlier script runs for a while and the starts independent cycling requiring careful timing of the ^c
About accelerometer. Oh my, Physics 101 anyone?
Acceleration is a change in the state of motion of an object, ie a change in its velocity vector, ie either speed or direction.
When the laptop is still on a table or moving at constant speed there is NO acceleration and the accelerometer reads 0. ZERO! (not the Earth gravity value)
When the speed changes, there is a variation of speed and there the accelerometer would measure an acceleration. That is, when the laptop is falling, under gravity, its speed is constantly changing (it accelerate toward the earth in the fall) and the accelerometer would measure an acceleration equal to gravity acceleration, not ZERO as apparently everyone here believes.
I've just tried doing the Summary steps on my MacBook, and it works just nice :)
Sometimes it lags a bit, or it misunderstands the direction i'm hitting, but it's already cool enough to be shown to friends :-P
I hope it will get included directly in a next VirtueDesktops review.
Richard: try moving the function definition to the top
like so:
#!/usr/bin/ruby
activation_speed = 3
sensor_speed = 0.1
cooldown_cycles = (1 / sensor_speed).round
coolingdown = 0
def get_next_x_speed()
file = IO.popen('./AMSTracker', 'r')
line = file.gets
# x y z
until sensor = /(-?\d+)\s+(-?\d+)\s+(-?\d+)/.match(line)
line = file.gets
end
file.close
return sensor[1].to_i
end
speed = get_next_x_speed()
while true
next_speed = get_next_x_speed()
difference = next_speed - speed
if coolingdown == 0
if difference.abs > activation_speed
direction = difference > 0 ? "Prev" : "Next"
`./notify SwitchTo#{direction}Workspace\n`
coolingdown = cooldown_cycles
end
else
coolingdown -= 1
end
speed = next_speed
sleep sensor_speed
end
I noticed that when i posted my ruby code above every line with a less-than symbol got cut off.. so it would only work in one direction.
I have posted the full code on my website as well as a summary and intructions of everything you need to get SmackBook working on your Intel MacBook Pros.
http://schf.uc.org/articles/2006/05/28/smackbook
Hope this helps.
vielleicht könnte jemand mal ne anleitung auf deutsch posten??
wär supergeil.. blick bei dem englischen nicht durch :(
greez
chris
thx a lot corban brook!
notify reacts on my smacks! but unfortunately not as expected. it returns
"permission denied"?!
moreover i don't know how to make virtuedesktop e.g. to respond to the smacking. what am i supposed to do with that "15-line program"? could you get a bit more specific on that?
not too familiar with that kind of stuff...
hope you guys can help me though.
thanks
@chris: sobald's bei mir läuft kann ich dir unter umständen schon weiterhelfen...
sileo:
The 15-line program is just the source code for the Notify binary if you require to compile it.
Just Download the notify Intel Binary and you should be fine.
For some reason it is not executable so you may need to chmod u+x the file so you can run it.
I guess people are not interested in this. But to Phys teacher in post 283, well... don't forget AMS is an *on-broad* sensor. It does feel gravity as an acceleration pointing in some direction. Indeed it uses this direction to measure the orientation of your MBP. What you said is not wrong, because that is the acceleration you can measure from a *fixed* lab.
Anyway, I guess all it matter is we are all having fun. :-)
FYI:
Another person doing work and posting the code related to AMS/SmackBook:
http://www.friday.com/bbum/2006/05/25/smacbook-pro/
Hey everyone, I've spent the last couple days working on an alternate smack.pl script. I've tested it and tried many different methods for improving accuracy and I think I've got the script to be about as good as I'm going to get it. If you're interested, you can download it here.
For those of you who need to know the juicy details before downloading, here they are. First, my script stores recent x values and uses their averages to determine when a tap occurs. This has the advantage of allowing you to have your computer at any inclination (including upside down).
Second, my script has a brief delay after a tap where it compares the pre-tap x values to the post-tap x values. The thought behind this is that with a tap, the x value spikes and then quickly returns to it's previous level. If for instance you are carrying your laptop, the x value usually won't be at the same level after the tap and therefore my script won't trigger a switch. I've found that it's pretty accurate for the most part.
If you download it and like it, send me an email letting me know what you think. My contact info is in the script.
P.S. I was going to try to put the script right into the comments here, but it has a lot of greater than and less than signs and I didn't want to have to go through and escape them all. It's a quick download anyway!
Well, even though it says I can use html in the comments, it appears my download link didn't come out. Here it is in plain text: http://web.mac.com/taavi/smack.zip
I have a build designed specifically for an ibook g4 with a patched for ppc desktop manager all bundled up. if you want it e-mail me okiefreeski@gmail.com
I just posted a super-sophistimicated version on my website. It combines notification and processing of AMSTracker messages into one package. The program also uses some stats to dynamically adjust for different tilt and varying levels of noise.
SmackNotify is active while I'm typing this message on my lap and SmackNotify rejects the noise just fine. Yet, it responds to mild smacks just like it should. :)
Get it here:
http://otri.ca/~otri/SmackNotify.zip
Usage:
AMSNotify -s -u 0.01 | ./smack
Enjoy!
- Aaron.
Victor, great source code! Now we can fix the 256*$a[1] problem!
I take a look in motion.c, and by change the data structure to
struct data {
char x[2];
char y[2];
char z[2];
char pad[37-3];
};
and fprintf statement as
fprintf(stdout, "%4d %4d %4d\n",
(unsigned char) outputStructure.x[0] + 256*(signed char) outputStructure.x[1],
(unsigned char) outputStructure.y[0] + 256*(signed char) outputStructure.y[1],
(unsigned char) outputStructure.z[0] + 256*(signed char) outputStructure.z[1]);
I'm able to obtain the value for each axis between some number from -2xx to +2xx. The ranges are different for different axis so I'm not sure what they really mean...
Anyway, also take a look at the linux version of motion tracker
http://www.popies.net/ams/
The registers defined in ams.c starting at line 51 may give us a pretty good guess at what information is contained in the padding... (for example, sensitivity low limit, sensitivity high limit) may be we can take some advantage of them...
Can someone advise if the Powerbook G4 550 Titanium has the SMS feature as I cannot find this anywhere....?????
I got it ... it doesn't have the sms feature ... tooooo bad... never mind ... i am thinking of switching to the new macbook pro after all...
i don't know if anybody mentioned, but u can with the freeware platypus (versiontracker) make a shellscript to perl the smack.pl Just mark shell and click new, then type the commands you used before in the terminal and save as application. You can start it and also change the icon.
I'm on a Powerbook g4 15'' last rev.
I have edited the perl script.. and it's great now.
I use it with VirtueDesktops.. i don't have tried with Desktop Manager.
You can download the zipped archive here : http://blog.nemstudio.com/billet/85/smackbook-sur-powerbook-g4.htm
I hope it will help you :)
The code :
open F,"./AMSTracker -s -u0.001 |";
while() {
my @a = /(-?\d+)/g;
print, next if @a != 3;
my $x = $a[0];
if(abs($x)
$stable++;
}
if(abs($x) > 20 && $stable > 5) {
print $x;
print "\n";
print $stable;
print "\n";
print "\n";
$stable = 0;
my $foo = $x
system "./notify SwitchTo${foo}Workspace\n";
}
}
Could anyone tell me if my SmackNotify program works on their system with VirtueDesktops?
http://otri.ca/~otri/SmackNotify.zip
I'd like to hear if it works ok on other people's kinds of laptops.
Oh yeah, the SmackNotify program is built as a universal binary.
is the smacknotify meant to work on macbooks or power/ibooks? because the two seem to run this totally differently.
SmackNotify should work on anything that AMSTracker supports. The range of values are automatically adjusted for, in fact you should be able to run SmackNotify while having the laptop on your lap. (heh.. what a concept!)
Changes in noise or lower levels of vibration are automatically adjusted for (standard deviation normalized), including any level of tilt (mean value compensation).
I have a PowerBook 15" 1.5GHz right before the High-res displays came out.
So, I would like to know, does SmackNotify do what it should and work just as well on macBooks and MBPro?
Wow, Taavi's solution of rejecting false switches from moving around is pretty cool.
I'd like to integrate that into SmackNotify.
Check out his msg - 294!
Thanks Taavi!
Aaron, feel free to use my script if you'd like to. I think it'd be cool if you integrated it into yours and included the standard deviation adjustments. Just send me a copy of whatever you come up with. Also, if you have any questions about the script, feel free to ask. My email is in the script comments. :-)
P.S. I got a couple other ideas that I was unable to effectively implement with my limited perl programming skills. If you think you may want to give them a try, send me an email and I'll get you a copy of my notes.
What would be kind of neat (not saying that this isn't) is if you could develop code to make the macbook pro invoke a switch from os x to windows via boot camp. But cheers for having this awesome idea!!!
greg > You can't switch like that. You have to "emulate" or "virtual" (sorry bad english :x) to do that. Parallels Desktop (http://www.parallels.com/) offer that. You can after switch with Smackbook pro to another desktop.. who have Parallels opened with Windows.
(mmmh i'm not sure you can understand with my poor english :D)
Ahaaaahaa, got it to work, and work well, I have to admit, Im a recent Mac user, so working in Terminal is just like using cmd prompt, with a little more flavor ;) . I have it working on my powerbook5,8 with no problems at all, no warm reboot required , and my macbookpro, it does however seem to work better on my macbook pro, with a lighter tap. But oh man, it was hilarious taking it into the Mac store and having the Mac geniuses say "what the hell??!!" and the customers at the counter saying how did you do that? and the mac genius says:
" yah how did you do that?, aren't you the guy that just recently started using macs?"
lol to funny!
Aaron, your script works just fine with VirtueDesktop and MacBook Pro 15". But it has big difficulties geting the directions, it more or less random which way you will go when you smack.
Also, it's a bit too sensitive. A very slight tap is enough to trigger a switch.
Started a little ruby cocoa application yesterday. with bundled notify (and hopefully bundling unimotion when that is available). It will run and allow you to turn on or off the bump motion.. and play with some sensitivity parametres.
Check out the screen shot: http://schf.uc.org/images/smackbookcocoa.png
Still need to tweak it a little but works ok right now.
Should be releasing it on my site: http://schf.uc.org in a couple days.
Let me know if you think a lauch app like this would be useful.
To get it to work on my iBook G4, I did the following (also described at: http://forums.bit-tech.net/showthread.php?p=1249931#post1249931 )
1. Downloaded .zip from post 182
2. Extracted to ~/Documents/
3. Downloaded AMSTracker from http://www.osxbook.com/software/sms/amstracker/
4. Saved in ~/Documents/smackbook/smackbook/
5. copied ~/Documents/smackbook folder to /Library/StartupItems
6. Entered my password
7. Went to [apple menu]>System Preferences>Accounts>Login Items
8. Added /Library/StartupItems/smackbook/smackbook/Desktop Manager.app
9. Rebooted
10. Clicked "fix" when it prompted me
11. Rebooted
12. Opened a terminal
13. changed to folder by typing "cd /Library/StartupItems/smackbook/smackbook"
14. started script by typing "perl smack.pl"
15. Smacked Away!
Ctrl+C quits.
Thanks for the cool features, everyone who helped this along!! (Martin/Lanoix/Erling/et all)
I had no problem installing everything with VirtueDesktops. I just installed the latest build of VirtueDesktops and the the original zip file for the Smackbook, and then I modified the smack.pl file for the iBook G4, and then I run it in terminal while VirtueDesktops is open. Simple as that. Only problem is that the terminal stays open all the time, and if I close the terminal and want to do this again, I have to restart, else it gives me a "software emulating hardware" error, or something like that. I'm looking forward to the new version of VirtueDesktops, which is supposed to have everything in this Smackbook fiasco integrated. :)
Just hooked this up with VirtueDesktops as per Bens (http://blog.medallia.com/2006/05/smacbook_pro.html#comment-314) post. Works great.
Although I have to work out how to switch to more than just previous and next desktop.
Well, all the way back to post #98...Desktop Manager crashes on startup. The console error log reads:
2006-05-31 19:19:36.260 Desktop Manager[263] An uncaught exception was raised
2006-05-31 19:19:36.285 Desktop Manager[263] *** -[NSCFString characterAtIndex:]: Range or index out of bounds
2006-05-31 19:19:36.285 Desktop Manager[263] *** Uncaught exception: *** -[NSCFString characterAtIndex:]: Range or index out of bounds
May 31 19:19:38 PowerBook crashdump[264]: Desktop Manager crashed
This is on a 15" PowerBook G4.
:-(
Since my post 316, I've downloaded VirtueDesktops and it works flawlessly.
Fantastic!
Only issue I have is that it will only change between the first 2 virtual desktops, it won't cycle through all 4....
OK, my final post. Everything is working. VirtueDesktops can be configured to have its virtual screens in a row or a grid. Changing the default 2x2 to a 4x1, and I can smack my way through all 4.
Diolch!
I tried a little arround to make it as a StartupItem Coolest thing would be if somebody could make some cute daemon which directly intercepts the AMS data without using AMSTracker (for performance reasons)
Problem will bee (i guess) that it must run under the same context as the DesktopManager, Thus, must be an User Startu Item. Any ideas? ;-)
Cheers Chriguf
It's also only a matter of time before VirtueDesktops integrates this feature. Since UNIMOTION has been released, it's bound to happen.
sooooo
i'm not a programmer, i get confused with code, and eye read this whole tread...
my brain is fried and you guys scare me with your knowledge.
but very good work.
i'm a guadraplegic who is stuck in bed and i have my 17in powerbook 1.5 htz baby velcroed to a lap beanbag bookholder on the side of my hip and i'm typeing with a pencil strapped to my hand. using the eracer face down
. and i miss my 2nd monitor so so bad!!!
yes i'm spoiled...
keep pluging on folks
wardbaby
Find the best online casino reviews. All this and more at http://www.online-casino-wizard.com
WOAW just discover this fantastic soft.
I installed it and I thought I could threw away my second screen but when for example using Flash it is impossible to put windows on one desktop and others on another desktop.
But well it is pretty amasing stuff.
Thanks a lot.
Hey!
Switchig next to prev is ok...but, can't make it change when there are more than three desktops (VirtueDesktops)...
like...is there any way to hit the screen from the top and make the new desktop appear?
Thanks
PS: sorry for my english =/
FR:
Lorsqu'on frappe des côtés ca marche nikel, mais j'arrive pas à faire apparaitre le 4eme bureau k'est sensé être au dessus...
quelq'un a une idée??
Vas dans les préférences de Virtue et mettre 4 colonnes (ou plus).
Apres tu fait alt + tab et tu déplace des bureaux en ligne. Après ca sera nickel :)
Brilliant! Works like a charm on my 12" powerbook.
Not while it sits on my lap though... every movement sets of a desktop switch :P
arne, the virtuedesktops version which can also be found on this page is less sensitive and work better on my 12" PB.
Brilliant work!
Works perfectly on my Macbook 13', it's only consistent when i tap on the right hand side however. Tapping on the left goes either way sometimes.
Works great on 1.5 PowerBook g4, used 237's dl and smack.pl from 293/294. WinXP Remote Desktop fullscreen on one, mac os x on the other!
For those people still trying to get it to work on their Macbook or Macbook Pro. I've written up dead simple instructions from beginning to end.
http://www.freemacblog.com/how-to-install-smackbook-on-a-macbook-pro/
Here is a quirk.. 17" Powerbook.
Scripts all work as expected, using VirtueDesktops. (tested all output via commandline)
Even got the AMSVisualizer from osxbook.com to make sure all was well. As expected the Visualizer worked just fine. As soon as I start an applicaiton however, AMStracker seems to be taking mouse input and not the SMS output. Anyone else run into this? The application I started was Firefox 1.5.0.4
For those without unix underpinnings, if you type
perl smack.pl &
insetad of
perl smack.pl
you don't need to keep the terminal window open, as you've opened the script in the background.
does any one have a solution to comment 117? thanks
http://blog.medallia.com/2006/05/smacbook_pro.html#comment-117
I compiled an intel version of everything and made a nice little tutorial @ www.lngdonline.com it Includes a links to download everything and I made an applescript to start everything. It is optimized for the 15inch Macbook Pro.
This app is awesome. I compiled it in Xcode using the patches put together in post 126. The app works but I'd like to shed the development directory left behind by xCode. If someone can help me with this, drop me a line. The modified app doesn't work without the dev directory.
Great code Alan. I like it better than running a script all the time.
Hey there,
As there are now 338 comments on this page, and as a bunch of those comments seem to have different ways of setting up this smack book concept, could someone please recap what the easiest way to set this up is? I have a macbook pro. Either shoot me an email, or maybe it could be updated at the top. I'm not terribly technically skilled with these various scripts, etc., so if there was a way to do this as a simple Mac OS X plugin or startup app running in the background, that would be amazing!
Came upon your blog and thought you might be interested in us. I do the news @ www.worldnewschannel1.com and we have 14 other internet tv channels (vlogs). We're developing a link page this week and we'd be happy to put you on there.
Thanks!
Jenn
It would be very cool to get a desktop shift working with the ambient light sensors. One could wave one's hand over the left or right sensor to switch desktops. This can be done without really moving your palms, and so is low impact for those of us with RSI.
solution to comment 117 & 336 is to downgrade to beta6 of paralles,
what you are describing only happend on paralles RC release
Hello, I'm Using lanoix smack.pl script, and it works fine, thanks lanoix!.
I have a few questions, say.. what is the scale os sensitivity? its a 13 by default, but in my iBook G4 it seems a little to hard of a smack, so i wonder if i can increase sensitivity, so i dont have to smack it that hard, what is less and what is more???
I'm planning on upgrading the original 40GB hdd to a 100GB fujitsu, does SMS come inside the HDD or is it independent of it? so if i change the HD is bye bye for SMS???
Has anyone got a way to fix the "Simulating" AMS hardware in software error???
... it sucks having to restart after a few runs...
Thanks!
dude, this program is great!!!
How long till this is an installer or app? I hate this whole putting it togehter thing
PLEASE HELP ME...
I followed everything from step 313... and then got stuck.
12. Opened a terminal
I spotlight for terminal and open it
13. changed to folder by typing "cd /Library/StartupItems/smackbook/smackbook"
I enter this into the terminal and is says -bash: /Library/StartupItems/smackbook/smackbook: No such file or directory
paul:~ Paul$
What am I doing wrong???
quote from #82: "c) Go to terminal, navigate to ~/Smackbook, and type: perl smack.pl"
I got to this step but I have no idea how to use terminal. My folder with smackbook.zip and AMSTracker-0.34.dmg is called "Smackbook" and is located on the desktop. Can anyone tell me EXACTLY what to type into terminal please
i've tried many of the suggestions provided here, but i still can't get it to work.
when i run smack.pl, it reads "Simulating" AMS hardware in software.
is this the problem?
appreciate for any help at all.
by the way, i am using a 1.5GHz G4 PowerBook
forget what i wrote in #349...
my real question is:
following original instructions, i got to #5: "You should have a directory with the files amstracker, notify and smack.pl. From the terminal, in that directory, run the command perl smack.pl"
My question is how do i use terminal? i got it opened but what exactly do i type? My folder with the three mentioneed things is called "smackbook Folder". I'm completely new to this coding stuff or whatev this is
to Dog on #352:
Just open terminal with spotlight, it will open right on your home directory, also called ~ , if you just download the smackbook.zip from safari you should see it on the desktop right? just type "cd Desktop" to change to the desktop dir, you should type all of the names exactly as they appear in screen, with upper or lower case they have... smackbook is not the same as Smackbook, so it will show an error, then type 'ls' to list all files in that directory, you should see everything you can see in your desktop, look for your "smackbook Folder", if it is listed with the ls command, type "cd smackbook\ Folder" , or just type "cd smack" and then press the TAB key and the shell will complete the name of the "smackbook Folder"... once you are inside the dir, type again ls, if you can see smack.pl just type perl smck.pl and it will work...
thanks sooo much...it works now! I like it. Plus i learned a lot. what exactly is terminal used for? I love to learn all this stuff for comps but dont know where to start. I had funw/ this lil project. Was that coding? prolly not, just making commands? If you have any advice for me to learn all about this. I don't understand at all what i just did lol but it worked so thanks again!
I was showing this off to some friends (and more), and I got more than a few "wow"'s. A guy from O'Reilly Media asked me to demo it at the Web 2.0 conference. I explicitly told him and the others that I did not come up with it, and that I had only made minor improvements. Nonetheless, he wanted it demoed. I offer you the chance to do the demo if you are in the San Fran area. Contact me if you can. If not, I'd like your blessing for me to demo it.
There's A Massive Tutorial Here:
http://www.applegeeks.com/sm/index.php/topic,7135.msg129483.html
which explains how to install (in baby steps + screenshots) on macbook/pro, plus how to use it on an iBook or powerbook by turning in down the sensitivity.
Well like i said earlier, i got it workin n my macbook(not pro) but it seems to switch in a random order :( I there certain way I should "smack it"? Or is there a way to make it so there are only 2 virtual desktops? thats all i need. Then i wouldn't matter which way i hit it. Or if u can't do that, can u make it so there are still 4 desktops but the sensor only picks up movement, not a certain direction so u just cycle through them all to get to the one i want. And like i said earlier I need the steps in a VERY easy to understand form.. this is the first time for me to do anything like this :)
i figured out how to add and subtract virtaul desktops but still need help with controlling which way it switches
RE: http://blog.medallia.com/2006/05/smacbook_pro.html#comment-166
Yes. It is possible on your PC. You will need to do the following registry edits:
Change "BootGUI=" to "BootGUI=0"
Then run any of the perl scrips above.
And since the sensitivity will be different on your PC as Macs are more delicate, you may have to tweak the sensitivity settings and hit your monitor more stiffly than normal.
I now have 4 things on my desktop.. the desktop manager... AMS tracker .dmg file, the AMS tracker (it's a white icon-thingy) and the smackbook folder... for this hack to work everytime i go on the computer, what needs to be kept? Do i have to enter the terminal command and keep it running every time i go on the computer? Do i need DM AND terminal running all the time for this?
I have the full install running on a G4 1.67... Anyone know of a way to avoid the secondary monitor output also switching... I want to keep a steady output onto the secondary for VJ use...
reply to #366(by Tim)
I was wondrin the EXACt smae thing lol, that would be awsome but seem unlikely to be possible but then again im COmPLETELY new to this kinda stuff
to dog on #354
no problem dog, the terminal is just another way of interacting with MacOSX, as you know MacOSX it's based on FreeBSD, and the mach kernel, which are opensource operating systems like linux and other freely distributed Unix type OS's, the 'cd' command is an acronym for 'Change Directory' and the 'ls' command is a short for 'list' as you saw, it lists all files whithin the current directory, back in ancient times, before apple invented/stole the graphical user interface, typing commands in the terminal was the only way of interacting with a computer, you would use commands like 'cp ' to copy a file to a disk or another folder, today dragging a file from one window to another is easier, but when you do that you are actually just telling the OS 'cp ', of course in a more gentle, easy way for the user, most graphical actions in Aqua (the name of the MacOSX GUI) are just a front-end for this terminal commands anyway...
for more information you can google for Unix Basic Commands, or Shell Commands, MacOSX uses the BASH Shell, that is good for starting...
Think there is any way we can have a sound effect when we smack to another desktop?
Ok, I got it going on my ibook G4...
I have never used terminal before, have been using mac for only 7 months, and a complete beginner in every sense of the way... but it works AMAZING!!!
The opening terminal everytime I turn the machine on is a little annoying... but I can live with it!
Thanks for the easy "how to" steps, and of course the code...
YOU ROCK!
on post #136 , we changed the values of the code from 30.
I am currently using an iBook running 10.4.6, and ive tried changing the vaules from 30, to 6, to 8 and to 15. They have worked in ways, but somehow when chatting or typing up word files it FLIPS??!?!? having the desktop flip halfway thru typing is abit annoying. anybody have a better configuration i could use?
currently using Virtue Desktop without terminal turned on and im just using hotkeys to flip between screens.
LOVES IT...!!! smackbook rules!
-G
I wrote a shell script to start Desktop Manager and then smack.pl and added it with Login Hooks so it works when I login.
Smart side effect, I can quit Desktop Manager and re-open it without having to go through the perl bit again.
Works a treat.
From my understanding, you need to open Terminal every time you start your OS X and type in the perl command to run the smac.pl.
How do I close that Terminal window while preserving the SmacBook (smacking the book will still change the desktop)?
Another question, how to automate the process of opening the terminal (and close it) everytime you start your OS X (like "Open at Login")?
Thanks!
To Gareth (post #375):
Can you please lay out step-by-step instructions on how to do so?
Thanks!
On my macbook, how can i make it MORE sensitive? I dont want to hafta hit it as hard as i am.
This was so cool that it inspired me (with prompting from friends) to create a retro "typewriter" variant - http://stephen.dsm.geek.nz/SmackEdit1.0.dmg no video but it'll crack older folk up watching you hit your computer to get a 'return'
Sorry if already been said, but I see the question has been asked a few times so...
If you run
perl smack.pl &
Then press enter after AMS has started you will return to a bash then just type quit and close the console, smack will stil be running.
I got this to work with Virtue Desktop, but not desktop manager...I dont need it but its really cool, thankyou, im no professional, but would like it more sensitive as i have a macbook, not a macbook pro
smackbook overdose
I installed Smackbook, but for some reason after I smacked, the VirtuaDesktop kept switching. I had the 'cube' effect selected, and the processor went crazy. Being a novice, I was wholly unable to stop the process. The smacking continued until the computer crashed and turned off. I think I need to take my macbook to a drugs clinic!!!
pure ownage!
i got this app working fine, but now can't seem to uninstall it...someone help!!
i know the answer of this was said in comment 387 but i cant get it to work, after initializing everything, i can get it working but then when i close terminal it stops working. I tried what was said in 387 but when i hit enter it wont go back to bash, it just keeps moving the courser down like if i was in text edit. Anyone know what to do to keep it always functioning?
You know, i still havent seen a link or a download for that little app with the blue balls that respond to movement of the window... Any idea when you'll be releasing it or showcasing it or something? Id really love to play around with it... :)
Here is a redone version that is a bit more stable across computers. Instead of using an absolute measure of the acceleration, it does a simple running average for the reference. It also has an option for the open motion instead of AMSTracker.
use strict;
my $stable = 0;
my $avg = 0;
#Chose your poison
open F,"./AMSTracker -s -u0.05 |";
#open F,"./motion 50 |";
while() {
my @a = /(-?\d+)/g;
print, next if @a != 3;
#MacBook users might need this funkiness
#$a[0] += 256 if $a[0]
my $y = $a[0];
if(abs($avg - $y) > 7 && $stable > 10) {
$stable = 0;
my $foo = ($avg - $y)
#Disable this if you like
print "${avg}:${y} ${foo}!\n";
system "./notify SwitchTo${foo}Workspace\n";
}
else {
$avg = ($avg + $y)/2;
$stable++;
}
}
i try run it on new 13" macbook. but it's not work for me. anybody can help
Hey, i just tried out everything, and i thought i followed the steps, but i guess not. I am running a HiRes Powerbook 12'. After doing the perl cmd, the screens just kept fliping. I had to go through some what of a hell to log off and stop it from fliping constantly. :D
Anyone think they can post some help?
check this out now u dont need to have terminal open on the main desktop. works great for me :)
http://www.apple.com/downloads/dashboard/developer/widgetterm.html
I've made an app which uses UniMotion for motion detection and notifies VirtueDesktop for tapping, so there's no need for separate amstracker/motion/unimotion, smack.pl and notify, this app replaces all three of them.
Feel free to download the app and sources:
http://koti.mbnet.fi/maz0r/SmackNotifier-0.1.zip
I'm using the 294 version of Taavis smack.pl and for some reason my ibook 12" doesn't do a single thing. The original smack.pl works, but is too sensitive so I thought that Taavis version would be the answer.
nice blog blog, congratulations from brazil
You rock Matti! Works like a charm!
anyone use it on 13" macbook. i try it.. it's not work. please help
Hi,
I had to change the code to work for me on PowerBook 12" 15Ghz. It was to sensible and not working for both sides (left and right) $a[0] was always 256 (or 254, 253). So the working code is below.
Thanks!
use strict;
my $stable;
open F,"./AMSTracker -s -u0.01 |";
while() {
my @a = /(-?\d+)/g;
print, next if @a != 3;
# we get a signed short written as two unsigned bytes
$a[0] += 0 if $a[0]
my $x = $a[0];
if(abs($x)
$stable++;
}
#print "stable = $stable\n";
#print "abs(x) = $x\n";
if(abs($x) > 1 && $stable > 30) {
$stable = 0;
my $foo = $x
system "./notify SwitchTo${foo}Workspace\n";
print "foo = ${foo} x = ${x}\n"
}
}
Okay guys, at least on the 12" power book there is some fundamental problems with the code included in smack.pl. To fix the problem with screens switching only one direction, you need to remove the line:
$a[0] += 256 if $a[0] < 0;
I've run the sms util manually and this code is incorrect. Hitting the right side of the laptop generates a relatively small (-15 or -20) number. Adding 256 to makes it behave as if you hit the left side. Then change the next line to:
my $x = $a[0];
instead of:
my $x = $a[1]*256 + $a[0];
Someone above mention that you should only use $a[1] and this is NOT true. This is the Y axis value and will not pick up X axis changes (side hits). As far as sensitivity, the values don't go very high and I noticed that changing to:
if(abs($x) < 25) {
is sufficient. If you go over 30 you have to hit pretty hard. Whatever you change that to, change the x value on the line:
if(abs($x) > 25 && $stable > 30) {
to the same value. The $stable num can be left alone (it's just a timing value for how much time it will respond between hits).
Hope this helps!
Does anyone have an installer for SmackBook? I just installed ShadowBook and it runs perfectly. Unfortunatly I dont know anything about programming and anything which is more complicated then an insaller is too much for me :-(
Can someone please email me with the installer? I would very much appreciate this. mail@willhealey.com
Thank you very very much, Will
Fantastic idea!
Will this work on a windows box?
I saw a tool for better centering your smackbook but i can not find it now so if anyone knows please tell me.
still having a bit of sensitivity issues with my PowerBook G4 12 inch from December 2005.
Everything WORKS its just far too sensitive. Any suggestions?
I've tried both Desktop Manager and VirtueDesktops and both seem to be just as sensitive.
if you know email me at:
ehmjay at gmail.com
this is a great tool for many and bragging rights for all macbook owners...but I have a 12'pb and i cant get it to work...already implimented what was posted on comment #136...but at the end when i type the "perl smack.pl" on the terminal...all i get is..."no such file or directory"...what should i do?
I followed the steps on CNET to get this to work and i couldnt get there. finally after messing around with it for awhile i found that the problem was that when u go to edit smack.pl in text edit that it shoud read my $x = $a[0] ;, NOT what CNET shows in their video. The problem is that it doesnt work when I end teminal. Anyone have an idea what is wrong?
i have a 2.16 MBP, and i don't know if anyone already answered this, but to make smackbook work without an open terminal window, you can just run the process in the background by adding a &
(perl smack.pl&) then you can quit terminal, and it will still run whenever DesktopManager is open.
hope that helps.
Hi anyone using a Black MacBook (I know the colour doesn't really matter ;-) might find this smack.pl code useful..
use strict;
my $stable;
open F,"./AMSTracker -s -u0.01 |";
while() {
my @a = /(-?\d+)/g;
print, next if @a != 3;# we get a signed short written as two unsigned bytes
$a[0] += 256 if $a[0] my $x = $a[0];if(abs($x) ) {
$stable++;
}if(abs($x) > 25 && $stable > 30) {
$stable = 0;
my $foo = $x system "./notify SwitchTo${foo}Workspace\n";
}
}
Can you run windows xp home edition on one of your desktops using smackbook?
I had Codetek virtual desktop and I liked it better than desktop manager for one reason.
You had the desktop browser preview in the bottom right corner, and could drag applications from one virtual desktop to another virtual desktop.
Anyway I can get this with Desktopmanager and smackbook?
maybe contact developer for a new version?
I like dragging windows between virtuals
david, i tried your smack.pl..
but still not work on my macbook
Thank you for stopping by my site
Hi dont know if the question already came up but i think my motion sensor doesnt work tried everything, i have a black macbook brand new. The sms is turned on but nothing happens anyone has an idea ? Help please
As a note on posts 202 And 204, if you enter the command as follows: user$ perl smack.pl &
Then hit enter twice, it should start the process in the background and allow you to quit terminal without killing the process.
Also, if you have root access on the machine(google this if you're unsure) you can start this behavior by default at system boot by doing the following:user$ su - root
Password: (enter your root password)
root$ cd /System/Library/StartupItems
root$ mkdir SmackBook
root$ chmod 755 SmackBook
root$ chown root:wheel SmackBook
root$ cd SmackBook
root$ pico SmackBook
Once in pico, enter the following:#!/bin/sh
##
#SmackBook Auto-Start by Mark R. Doering (email withheld by request (#1218) --alf)
##
perl smack.pl &
Then press ctrl+x then press 'y' to save, and enter to use the above name.
Then Type:root$ chmod 755 SmackBook
And finally, move the contents of the SmackBook.zip file into the /System/Library/StartupItems/SmackBook folder by typing the following:cd /Path/To/SmackBook\ Files/
cp * /System/Library/StartupItems/SmackBook/
And if everything worked out right, when you reboot, you should be able to smack away!(Note: You must also have the desktop manager of your choice also set to launch at login) If you have any questions, feel free to e-mail me.(like the related software, this information is provided for educational purposes only and I take no responsibility if you hose your system by following theese instructions...)
I appologize to those of you who followed the directions I outlined above for making SmackBook auto-start, I neglected to include some additional code that makes this work on out-of-the-box Macs. I will post an update and with the permission of Erling, a zip file that will make the process slightly easier(containing the files needed to make it auto-start) shortly.
It seems that vitrue desktop can do all of the smackbook stuff all on its own with the most recent build. The only problem is that every time I tap the side, the desktop changes twice. If anyone can help, please IM me on AIM at SubzeroAsh.
Is it possible to use this on a inspiron 6000 or is it only limited to the type of laptops you listed?
ok.. this is not workin' for me!
i've tried ALL of the alternatives on changing "smack.pl" but it just doesn't work..
*i hav a macbook pro 17"*
will someone help me?
or.. ppl who got their 17" workin'.. just paste the smack.pl source code for me please?
As stated by Ashwin, VirtueDesktops now supports smackbook-like functionality natively. Thus I have ceased working on creating a smackbook daemon. If anyone is interested in continuing developement for whatever reason, contact me through my website and I will send you the code I have thus far.
Note to the editor: if possible, can you either remove my previous postings, and/or edit them to remove my e-mail address? apparently those fun little e-mail addy harvesting bots like scanning your page ;-) Thank You [removed now... -alf]
Even though the installation went great and it's working, I find it to be too sensitive for my taste. If only someone could write a tutorial on how to uninstall the Smackbook, that would be really great.
Sehr guten site. Alles arbeitet deutlich(klar), schon eben storungsfrei. Wer machte? Vielleicht vom Weg?
How i can reset my AMS, I have a 17"PB G4 1,67????
In reference 240 i can'y find the response.
Thanks.
whatever happened to the little window full of water / balls thing in the original smackbook demo video?
just wondering.
Nice to see that the site is finally online :)
Thanks for the code. I might even want to steal your map in the header since I'm another scandinavian living in the SF bay area...
Jim