File tree Expand file tree Collapse file tree 1 file changed +12
-9
lines changed
Expand file tree Collapse file tree 1 file changed +12
-9
lines changed Original file line number Diff line number Diff line change 1- import os , time
1+ import os
2+ import time
3+
4+ CLIPBOARD_BUFFER_FILE = "/tmp/clipboard"
25
3- CLIPBOARD_BUFFER_FILE = "/tmp/clipboard"
46
57def start_clipboard_service ():
68 """
79 watch if clipboard buffer file has changed
810 if true, then pipe content buffer to xclip
911 """
10- buffer = os .popen (f"cat { CLIPBOARD_BUFFER_FILE } " ).read ().strip ()
11-
12+ buffer = os .popen (f"cat { CLIPBOARD_BUFFER_FILE } " ).read ().strip ()
13+
1214 # check is xclip installed
1315 _xclip = os .popen ("which xclip" ).read ().strip ()
1416 if _xclip is None :
1517 print ("xclip not found" )
1618 os .exit (1 )
17-
19+
1820 while os .getenv ('DISPLAY' ) is not None :
1921 time .sleep (0.4 )
2022 if os .path .exists (CLIPBOARD_BUFFER_FILE ):
21- if buffer != os .popen (f"cat { CLIPBOARD_BUFFER_FILE } " ).read ().strip ():
22- os .system (f"cat { CLIPBOARD_BUFFER_FILE } | xclip -selection clipboard" )
23- buffer = os .popen (f"cat { CLIPBOARD_BUFFER_FILE } " ).read ().strip ()
23+ if buffer != os .popen (f"cat { CLIPBOARD_BUFFER_FILE } " ).read ().strip ():
24+ os .system (
25+ f"cat { CLIPBOARD_BUFFER_FILE } | xclip -selection clipboard" )
26+ buffer = os .popen (
27+ f"cat { CLIPBOARD_BUFFER_FILE } " ).read ().strip ()
2428 else :
2529 print ("clipboard buffer file not found" )
2630 os .exit (1 )
27-
You can’t perform that action at this time.
0 commit comments