Reduce clipboard timeout to 30 seconds

This commit is contained in:
2022-05-16 00:16:45 -04:00
parent 1687d9e1e2
commit 551f1e8f50
+4 -4
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 45; clipboard -r'
_clear_command = 'sleep 30; clipboard -r'
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 45; termux-clipboard-set ''"
_clear_command = "sleep 30; termux-clipboard-set ''"
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 45; wl-copy -c'
_clear_command = 'sleep 30; wl-copy -c'
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,7 +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 45; echo -n '' | xclip -sel c"
_clear_command = "sleep 30; echo -n '' | xclip -sel c"
Popen(_clear_command, shell=True)
rmtree(f"{tmp_dir}{_shm_folder}")