diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2024-11-17 23:02:08 +1300 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2024-11-17 23:02:08 +1300 |
commit | ffb444f1e7269115308cb78147561adc67faebc2 (patch) | |
tree | 371c12919d248554f2ba6d306f863785c7f10274 | |
parent | Add system config file (diff) | |
download | vixf-ffb444f1e7269115308cb78147561adc67faebc2.tar.gz vixf-ffb444f1e7269115308cb78147561adc67faebc2.zip |
Treat empty temp file as an error condition
-rw-r--r-- | vixf.py3 | 13 |
1 files changed, 8 insertions, 5 deletions
@@ -99,15 +99,18 @@ def main(environ): # If any data in the file after edit, copy it to the clipboard if len(content_after): pyperclip.copy(content_after) + else: + print( + f'{SELF}: Nothing to paste. Did the edit work?', + file=sys.stderr, + ) + sys.exit(1) focus_delay(config) - # If we had content, paste it; if we didn't, cut what was there + # Paste modified content with keyboard.pressed(pynput.keyboard.Key.ctrl): - if len(content_after): - keyboard.type('v') - else: - keyboard.type('x') + keyboard.type('v') def focus_delay(config): |