mirror of
https://github.com/rwinkhart/sshyp.git
synced 2026-08-28 04:46:34 -04:00
Reduced lines used for clipboard clearing
This commit is contained in:
@@ -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}")
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user