Reduced lines used for clipboard clearing

This commit is contained in:
2022-05-16 00:23:03 -04:00
parent 551f1e8f50
commit f869e3b45d
+4 -5
View File
@@ -522,7 +522,7 @@ def copy_data(): # copies a specified field of an entry to the clipboard
system('clipboard -c ' + "'" + _copy_line[2].replace('\n', '').replace("'", "'\\''") + "'")
elif argument.startswith('copy note') or argument.startswith('copy -n'):
system('clipboard -c ' + "'" + _copy_line[4].replace('\n', '').replace("'", "'\\''") + "'")
_clear_command = 'sleep 30; clipboard -r'
Popen('sleep 30; clipboard -r', shell=True)
elif Path("/data/data/com.termux").exists(): # Termux (Android) clipboard detection
if argument.startswith('copy username') or argument.startswith('copy -u'):
system('termux-clipboard-set ' + "'" + _copy_line[0].replace('\n', '').replace("'", "'\\''") + "'")
@@ -532,7 +532,7 @@ def copy_data(): # copies a specified field of an entry to the clipboard
system('termux-clipboard-set ' + "'" + _copy_line[2].replace('\n', '').replace("'", "'\\''") + "'")
elif argument.startswith('copy note') or argument.startswith('copy -n'):
system('termux-clipboard-set ' + "'" + _copy_line[4].replace('\n', '').replace("'", "'\\''") + "'")
_clear_command = "sleep 30; termux-clipboard-set ''"
Popen("sleep 30; termux-clipboard-set ''", shell=True)
elif environ.get('WAYLAND_DISPLAY') == 'wayland-0': # Wayland clipboard detection
if argument.startswith('copy username') or argument.startswith('copy -u'):
system('wl-copy ' + "'" + _copy_line[0].replace('\n', '').replace("'", "'\\''") + "'")
@@ -542,7 +542,7 @@ def copy_data(): # copies a specified field of an entry to the clipboard
system('wl-copy ' + "'" + _copy_line[2].replace('\n', '').replace("'", "'\\''") + "'")
elif argument.startswith('copy note') or argument.startswith('copy -n'):
system('wl-copy ' + "'" + _copy_line[4].replace('\n', '').replace("'", "'\\''") + "'")
_clear_command = 'sleep 30; wl-copy -c'
Popen('sleep 30; wl-copy -c', shell=True)
else: # X11 clipboard detection
if argument.startswith('copy username') or argument.startswith('copy -u'):
system('echo -n ' + "'" + _copy_line[0].replace('\n', '').replace("'", "'\\''") + "'" + ' | xclip -sel c')
@@ -552,8 +552,7 @@ def copy_data(): # copies a specified field of an entry to the clipboard
system('echo -n ' + "'" + _copy_line[2].replace('\n', '').replace("'", "'\\''") + "'" + ' | xclip -sel c')
elif argument.startswith('copy note') or argument.startswith('copy -n'):
system('echo -n ' + "'" + _copy_line[4].replace('\n', '').replace("'", "'\\''") + "'" + ' | xclip -sel c')
_clear_command = "sleep 30; echo -n '' | xclip -sel c"
Popen(_clear_command, shell=True)
Popen("sleep 30; echo -n '' | xclip -sel c", shell=True)
rmtree(f"{tmp_dir}{_shm_folder}")