Created
August 12, 2020 14:17
-
-
Save subtosilencio/c82bf5a50a14c7731e82a6b6ed904ab2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
# Linux Ubuntu Gnome | |
# Correction for Pyperclip | |
# Copy info to clipboard without installing anything | |
from gi.repository import Gtk, Gdk | |
def copy_to_clipboard(msg): | |
''' Copy `msg` to the clipboard ''' | |
cb = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD) | |
cb.set_text(msg,-1) | |
cb.store() | |
def paste_from_clipboard(): | |
''' Paste last info from clipboard ''' | |
cb = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD) | |
return cb.wait_for_text() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment