-
Notifications
You must be signed in to change notification settings - Fork 204
Open
Description
xclip is rarely installed by default. If not, a helper script can be used instead, using for example python with one of commonly installed by default modules. Like this:
#!/usr/bin/env python3
import sys
import tkinter as tk
root = tk.Tk()
root.withdraw() # hide the main window
if len(sys.argv) > 1:
# write text to the clipboard
text = " ".join(sys.argv[1:])
root.clipboard_clear()
root.clipboard_append(text)
root.update()
# keep the Tk window alive a little longer so X11 can persist the clipboard
root.after(10, root.destroy)
root.mainloop()
else:
# read text from the clipboard
try:
print(root.clipboard_get())
except tk.TclError:
print("", end="")
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels