mirror of
https://github.com/rwinkhart/sshyp.git
synced 2026-08-30 05:46:31 -04:00
Fix formatting of strings being fed through printf for X11 and MacOS
Former-commit-id: 1056b7c8efb6193ce4b43a7d72b2151aabee3559 Former-commit-id: c7b16925d45d3cffba08bac600044954e9561bd8
This commit is contained in:
+4
-2
@@ -707,13 +707,15 @@ def copy_data(): # copies a specified field of an entry to the clipboard
|
||||
run(['clipboard', '-c', _copy_line[_index].rstrip()])
|
||||
Popen('sleep 30; clipboard -r', shell=True)
|
||||
elif uname()[0] == 'Darwin': # MacOS clipboard detection
|
||||
run(['pbcopy'], stdin=Popen(['printf', _copy_line[_index].rstrip()], stdout=PIPE).stdout)
|
||||
run(['pbcopy'], stdin=Popen(['printf', _copy_line[_index].rstrip().replace('\\', '\\\\').replace('%', '%%')],
|
||||
stdout=PIPE).stdout)
|
||||
Popen("sleep 30; printf '' | pbcopy", shell=True)
|
||||
elif exists("/data/data/com.termux"): # Termux (Android) clipboard detection
|
||||
run(['termux-clipboard-set', _copy_line[_index].rstrip()])
|
||||
Popen("sleep 30; termux-clipboard-set ''", shell=True)
|
||||
else: # X11 clipboard detection
|
||||
run(['xclip', '-sel', 'c'], stdin=Popen(['printf', _copy_line[_index].rstrip()], stdout=PIPE).stdout)
|
||||
run(['xclip', '-sel', 'c'], stdin=Popen(['printf', _copy_line[_index].rstrip().replace('\\', '\\\\')
|
||||
.replace('%', '%%')], stdout=PIPE).stdout)
|
||||
Popen("sleep 30; printf '' | xclip -sel c", shell=True)
|
||||
rmtree(f"{tmp_dir}{_shm_folder}")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user