Maybe I missunderstood yesterday GS4 announcement, but I think this is one of their new features. And about implementing it, a daemon reading the accelerometer data all the time and maybe sending xwindow messages? not sure how much it will affect the battery life though.