Skip to content
Snippets Groups Projects
Commit a8c467de authored by root's avatar root
Browse files

Merge branch 'master' of /home/dstan/cranspasswords

parents e52ada6c 6a9d14b5
No related branches found
No related tags found
No related merge requests found
......@@ -220,7 +220,24 @@ def show_roles():
if role.endswith('-w'): continue
print " * " + role
old_clipboard = None
def saveclipboard(restore=False):
global old_clipboard
if restore and old_clipboard == None:
return
act = '-in' if restore else '-out'
proc =subprocess.Popen(['xclip',act,'-selection','clipboard'],\
stdin=subprocess.PIPE,stdout=subprocess.PIPE,stderr=sys.stderr)
if not restore:
old_clipboard = proc.stdout.read()
else:
raw_input("Appuyez sur une touche pour récupérer le contenu précédent du presse papier.")
proc.stdin.write(old_clipboard)
proc.stdin.close()
proc.stdout.close()
def clipboard(texte):
saveclipboard()
proc =subprocess.Popen(['xclip','-selection','clipboard'],\
stdin=subprocess.PIPE,stdout=sys.stdout,stderr=sys.stderr)
proc.stdin.write(texte)
......@@ -409,4 +426,6 @@ if __name__ == "__main__":
parser.print_help()
else:
parsed.action(parsed.fname)
saveclipboard(restore=True)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment