cutting and pasting with keyboard
- From: D M German <dmg uvic ca>
- To: sawfish-list gnome org
- Subject: cutting and pasting with keyboard
- Date: Mon, 31 Jan 2011 21:27:41 +0900
Hi everybody,
I have been using the following extension to cut-and-paste with the
keyboard (primary and secondary selection). The problem I have is that
the function dmg-type-in-window sometimes fails with an error, and it
does not support unicode (such as Japanese characters).
I wonder if there is a simpler way to do this. What I want is just be
able to paste with the keyboard, without having to use the mouse.
Does anybody have a suggestion on how to do this in a better way?
thanks a lot!
-dmg
----------------------------------------------------------------------
(require 'sawfish.wm.keymaps)
(require 'sawfish.wm.util.selection)
(require 'sawfish.wm.util.window-order)
(require 'sawfish.wm.workspace)
;(defvar dmg-selection-paste-command "xsel -b ''")
(defvar dmg-selection-clear-cmd "xsel -c &")
(defvar dmg-selection-swap-cmd "xsel -x &")
(defun dmg-type-in-window (str wind #!optional ret)
(cond ((string= str "")
(when ret (synthesize-event "Return" wind)))
(t (if (string= (substring str 0 1) "\n")
(synthesize-event "Return" wind)
(synthesize-event (substring str 0 1) wind))
(dmg-type-in-window (substring str 1) wind ret))))
(defun dmg-paste-clipboard (w)
(interactive "%W")
(setq sel (x-get-selection 'CLIPBOARD))
(dmg-type-in-window sel w)
t
)
(defun dmg-paste-primary (w)
(interactive "%W")
(setq sel (x-get-selection 'PRIMARY))
(dmg-type-in-window sel w)
t
)
(defun dmg-paste-secondary (w)
(interactive "%W")
(setq sel (x-get-selection 'SECONDARY))
(dmg-type-in-window sel w)
t
)
(defun dmg-clear-selection ()
(interactive "")
(system dmg-selection-clear-cmd)
)
(defun dmg-swap-selection ()
(interactive "")
(system dmg-selection-swap-cmd)
)
(provide 'dmg-selection)
--
--
Daniel M. German
http://turingmachine.org/
http://silvernegative.com/
dmg (at) uvic (dot) ca
replace (at) with @ and (dot) with .
[
Date Prev][Date Next] [
Thread Prev][Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]