module Clipboard::Gtk
Ruby-Gnome2 based implementation Requires either the gtk3 or the gtk2 gem
Constants
- CLIPBOARDS
Public Instance Methods
clear(clipboard: "all")
click to toggle source
# File lib/clipboard/gtk.rb, line 46 def clear(clipboard: "all") selections = clipboard.to_s == "all" ? CLIPBOARDS : [clipboard] selections.each{ |selection| raise ArgumentError, "unknown clipboard selection" unless CLIPBOARDS.include?(selection) ::Gtk::Clipboard.get(Gdk::Selection.const_get(selection.to_s.upcase)).clear } true end
copy(data, clipboard: "all")
click to toggle source
# File lib/clipboard/gtk.rb, line 35 def copy(data, clipboard: "all") selections = clipboard.to_s == "all" ? CLIPBOARDS : [clipboard] selections.each{ |selection| raise ArgumentError, "unknown clipboard selection" unless CLIPBOARDS.include?(selection) ::Gtk::Clipboard.get(Gdk::Selection.const_get(selection.to_s.upcase)).set_text(data).store } true end
paste(which = nil, clipboard: "clipboard")
click to toggle source
# File lib/clipboard/gtk.rb, line 26 def paste(which = nil, clipboard: "clipboard") selection = which || clipboard raise ArgumentError, "unknown clipboard selection" unless CLIPBOARDS.include?(selection) ::Gtk::Clipboard.get( Gdk::Selection.const_get(selection.to_s.upcase) ).wait_for_text || "" end