Skip to content

Commit f34a99d

Browse files
Merge pull request #14 from Ayon-SSP/patch-2
Bug Fix #11 and #12
2 parents af620f6 + a9b35e5 commit f34a99d

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

utils/clipboard_watcher.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
# watch if clipboard buffer file has changed with last modified time
77
# if changed, then copy the content to clipboard
88
def start_clipboard_service():
9-
last_modified_time = os.path.getmtime(CLIPBOARD_BUFFER_FILE)
9+
buffer=os.popen(f"cat {CLIPBOARD_BUFFER_FILE}").read().strip()
10+
1011
# check is xclip installed
1112
_xclip = os.popen("which xclip").read().strip()
1213
if _xclip is None:
@@ -16,9 +17,9 @@ def start_clipboard_service():
1617
while os.getenv('DISPLAY') is not None:
1718
time.sleep(0.4)
1819
if os.path.exists(CLIPBOARD_BUFFER_FILE):
19-
if os.path.getmtime(CLIPBOARD_BUFFER_FILE) != last_modified_time:
20+
if buffer!=os.popen(f"cat {CLIPBOARD_BUFFER_FILE}").read().strip():
2021
os.system(f"cat {CLIPBOARD_BUFFER_FILE} | xclip -selection clipboard")
21-
last_modified_time = os.path.getmtime(CLIPBOARD_BUFFER_FILE)
22+
buffer=os.popen(f"cat {CLIPBOARD_BUFFER_FILE}").read().strip()
2223
else:
2324
print("clipboard buffer file not found")
2425
os.exit(1)

0 commit comments

Comments
 (0)