Welcome to Deadman.org.

Debian
Creative Commons License

Mouseless Pasting in Sawfish
Thursday Jun 2 7:40am 2005
by Deadman

I still use sawfish and I hope it never ever goes away. I love it. Here's a great example of why I love it.

I hate the mouse, so I wanted to have an equivalent of xterm's ctrl-ins (clipboard paste) in every window. mmc on irc.freenode.net's #sawfish channel was kind enough to whip this up for me:

(require 'sawfish.wm.util.selection)
(define (send-string-to-window s w)
  (let ((i 0))
    (while (< i (length s))
           (let* ((ch (substring s i (setq i (1+ i))))
                  (e (cond ((equal ch "\n") "RET")
                           (t ch))))
             (synthesize-event e w)))))
(defun send-selection (window)
  (interactive "%W")
  (send-string-to-window
    (x-get-selection 'PRIMARY) window))

Just put that in ~/.sawfish/rc (or ~/.sawfishrc if you already have one,) restart sawfish and edit your bindings. You'll see a new action called send-selection that you can bind to whatever key you want. I chose ctrl-; because it seemed unlikely that any app would use that binding already.

Home

© 2008 Sam Rowe. All rights reserved.
RSS headlines