[linux-elitists] Jef Raskin's "Calculate", or, "save an F key for eval"

Don Marti dmarti@zgp.org
Fri Mar 4 11:09:59 PST 2005


Jef Raskin wrote,

  All that is really needed on computers is a
  "Calculate" button or omnipresent menu command that
  allows you to take an arithmetic expression, like
  248.93 / 375, select it, and do the calculation
  whether in the word processor, communications
  package, drawing or presentation application or
  just at the desktop level.

  http://jef.raskincenter.org/unpublished/widgets_of_the_week.html#anchor1110313

That's a really great idea, so I'm going to publish
this Real Working Implementation before some patent
bandit does.

  xte 'keydown Control_L' 'key c' 'keyup Control_L' && \
  perl -e 'print eval `xsel -b -o`' | xsel -b -i  && \
  xte 'keydown Control_L' 'key v' 'keyup Control_L'

(That is, copy the selected text into the X clipboard
selection, do a Perl "eval" on the clipboard selection
and replace the contents of the clipboard selection
with the results, then do a paste.)

I now have this bound to the "Access IBM" button on
a ThinkPad.  And another way to do it is here,

  http://zgp.org/~dmarti/blosxom/tips/eval-button.html

along with links for where to get xte and xsel.

-- 
Don Marti
http://zgp.org/~dmarti/
dmarti@zgp.org



More information about the linux-elitists mailing list