[kupfer: 5/6] clipboard: new options: copy selection to primary clipboard



commit ef5febdb4aca4cbfb8239d3cbd1da59d5a40b494
Author: Karol BÄ?dkowski <karol bedkowski gmail com>
Date:   Fri Apr 16 16:37:14 2010 +0200

    clipboard: new options: copy selection to primary clipboard
    
    This functions is called "syncing clipboards" in other clipboard
    managers. Selected text is coped to the primary clipboard.

 kupfer/plugin/clipboard.py |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/kupfer/plugin/clipboard.py b/kupfer/plugin/clipboard.py
index b10360e..502450b 100644
--- a/kupfer/plugin/clipboard.py
+++ b/kupfer/plugin/clipboard.py
@@ -27,6 +27,12 @@ __kupfer_settings__ = plugin_support.PluginSettings(
 		"type": bool,
 		"value": False,
 	},
+	{
+		"key" : "sync_selection",
+		"label": _("Copy selection to primary clipboard"),
+		"type": bool,
+		"value": False,
+	},
 )
 
 class ClipboardText (TextLeaf):
@@ -90,6 +96,9 @@ class ClipboardSource (Source):
 			self.clipboards.pop()
 		self.clipboards.append(newtext)
 
+		if is_selection and __kupfer_settings__["sync_selection"]:
+			gtk.clipboard_get(gtk.gdk.SELECTION_CLIPBOARD).set_text(newtext)
+
 		while len(self.clipboards) > max_len:
 			self.clipboards.popleft()
 		self.mark_for_update()



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]