From f869e3b45de6d582449997da75cac3fb6e8e0989 Mon Sep 17 00:00:00 2001 From: Randall Winkhart Date: Mon, 16 May 2022 00:23:03 -0400 Subject: [PATCH] Reduced lines used for clipboard clearing --- bin/sshyp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/bin/sshyp b/bin/sshyp index 957cd20..06071ae 100755 --- a/bin/sshyp +++ b/bin/sshyp @@ -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}")