Shoesies:
Below my sig is a script that...
- detects if you have synaptic touchpad drivers, via synclient
- advises if you don't
- roughly tracks your finger on the touch pad
- paints your finger-painting (a-la good-follow.rb)
This leads to a form of good-follow.rb that bypasses your mouse driver's system,
to offset your mouse pointer and abstract its motion. What you touch is what you
get.
And here's some problems and issues my little script raises:
- my Kubuntu drivers throw away goodies like the number of fingers
the width of a finger point, etc
- popen-ing to svnclient is reeeally tacky, and unstable
- some rare fringe platforms out there might not have synaptics
- some rare fringe platforms out there might not have touchpads
Beyond those minor obstacles, one major annoyance in modern computing is all our
workstations and notebooks have much more hardware and computing power than an
iPhone, yet the latter gets all the good press. Everyone else has touchpads,
too, so our fingers should be dialing, swiping, plucking, and drag-n-dropping
with them, already!
--
Phlip
require 'io/nonblock'
Shoes.app :width => 500, :height => 400 do
synclient = `which synclient`.sub(/\n$/, '')
if synclient.any?
@fn = IO.popen("#{synclient} -m 50")
@fn.nonblock = true
nostroke
fill rgb(0x30, 0xBB, 0x40, 0.6)
@trails = [[0,0,0]] * 100
animate 20 do
line = @fn.read
if line.nil? or line.empty?
alert 'no blockage'
else
# " time x y z f w l r u d m multi gl gm gr gdx gdy\n"
# " 0.000 628 531 0 0 0 0 0 0 0 0 00000000 0 0 0 0 0\n"
# " 1.501 368 480 74 1 0 0 0 0 0 0 00000000 0 0 0 0 0\n"
line = line.split("\n").last if line !~ /time/
exx, why, pressure, fingers =
line.split(' ').compact[1..4].map{|q| q.to_i }
if fingers == 1
@trails.shift
@trails << [exx / 2, why / 2, pressure / 2]
clear do
@trails.select{|t| t.first > 0}.each do |t|
oval *t
end
end
end
end
end
# TODO how to turn the popen off when the app goes down?
else
para 'This program requires "',
link(strong(:synclient), :click =>
'http://www.google.com/search?q=synclient+synaptics' ),
'" (and "', strong(:which), '!") to detect your touchpad, if any'
end
end