Skip to content

Commit

Permalink
clipboard listen for changes of the source file
Browse files Browse the repository at this point in the history
  • Loading branch information
kalkin committed Aug 17, 2017
1 parent 2cbca13 commit 46de1f0
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions qui/clipboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,14 @@ def _notify(self, body):
self.last_id = self.notifications_iface.Notify(
'', self.last_id, '', 'Qubes Clipboard', body, [], [], 5)

def process_IN_MODIFY(self, _):
''' Reacts to modifications of the DATA file '''
vm_from_file = open(FROM, 'r')
src_vmname = vm_from_file.readline().strip('\n')
if src_vmname == "":
def process_IN_CLOSE_WRITE(self, _):
''' Reacts to modifications of the FROM file '''
with open(FROM, 'r') as vm_from_file:
vmname = vm_from_file.readline().strip('\n')
if vmname == "":
self._paste()
else:
self._copy(vmname=src_vmname)
self._copy(vmname=vmname)

def process_IN_MOVE_SELF(self, _):
''' Stop loop if file is moved '''
Expand Down Expand Up @@ -134,7 +134,7 @@ def main():
if not os.path.exists(DATA):
time.sleep(0.5)
else:
wm.add_watch(DATA, mask)
wm.add_watch(FROM, mask)
handler = EventHandler(loop=loop)
pyinotify.AsyncioNotifier(wm, loop, default_proc_fun=handler)
loop.run_forever()
Expand Down

0 comments on commit 46de1f0

Please sign in to comment.