General cleanup and port-job updates

Former-commit-id: 343ec2505e3ee3858089ee0a4b5175c6029ad23f
Former-commit-id: 7cd32bc931d57e39166c62174561b6c7fdacb9cf
This commit is contained in:
2023-06-01 23:09:53 -04:00
parent f36a7f5672
commit a1ea9d6831
4 changed files with 26 additions and 23 deletions
+14 -10
View File
@@ -378,6 +378,15 @@ this program comes with absolutely no warranty; type 'sshyp license' for details
# PORT END HELP-SERVER
# shortcut to quickly read an entry
def read_shortcut():
target_type_check(entry_name, True, True)
_shm_folder, _shm_entry = shm_gen()
determine_decrypt(directory + entry_name, _shm_folder, _shm_entry)
entry_reader(f"{tmp_dir}{_shm_folder}/{_shm_entry}")
rmtree(f"{tmp_dir}{_shm_folder}")
# calls sshync to sync changes to the user's server
def sync():
print('\nsyncing entries with the server device...\n')
@@ -539,7 +548,7 @@ def rename():
from shutil import copy
# check if the renaming target is an entry (file) or a folder
_file = target_type_check(entry_name)
_file = target_type_check(entry_name)
# collect the new name for the target from user input
_new_name = str(input('new name: ')).strip('/')
@@ -665,8 +674,8 @@ def copy_data():
Popen('sleep 30; clipboard -r', shell=True)
# MacOS clipboard detection
elif uname()[0] == 'Darwin':
run(('pbcopy'), stdin=Popen(('printf', _copy_subject.replace('\\', '\\\\').replace('%', '%%')),
stdout=PIPE).stdout)
run('pbcopy', stdin=Popen(('printf', _copy_subject.replace('\\', '\\\\').replace('%', '%%')), stdout=PIPE)
.stdout)
Popen("sleep 30; printf '' | pbcopy", shell=True)
# Termux (Android) clipboard detection
elif isdir("/data/data/com.termux"):
@@ -679,7 +688,7 @@ def copy_data():
Popen("sleep 30; printf '' | xclip -sel c", shell=True)
else:
print('\n\u001b[38;5;9merror: clipboard tool could not be determined\n\nnote that the clipboard does not '
'function in a raw tty\u001b[0m\n')
'function in a raw tty\u001b[0m\n')
# PORT END CLIPBOARD
rmtree(f"{tmp_dir}{_shm_folder}")
@@ -816,13 +825,8 @@ if __name__ == "__main__":
elif arg_count == 1:
if arg_start == 1:
# read shortcut
success_flag = True
target_type_check(entry_name, True, True)
_shm_folder, _shm_entry = shm_gen()
determine_decrypt(directory + entry_name, _shm_folder, _shm_entry)
entry_reader(f"{tmp_dir}{_shm_folder}/{_shm_entry}")
rmtree(f"{tmp_dir}{_shm_folder}")
read_shortcut()
elif arguments[0] == 'tweak':
success_flag = True
from stweak import menu_repeat
+3 -3
View File
@@ -352,9 +352,9 @@ def initial_setup():
# PORT START CLIPTOOL
# check for clipboard tool and display warning if missing
if uname()[0] in ('Linux', 'FreeBSD') and not 'WSL_DISTRO_NAME' in environ \
and not exists("/data/data/com.termux"):
_display_server = None
if uname()[0] in ('Linux', 'FreeBSD') and 'WSL_DISTRO_NAME' not in environ \
and not exists("/data/data/com.termux"):
_display_server, _clipboard_tool, _clipboard_package = None, None, None
if 'WAYLAND_DISPLAY' in environ:
_display_server, _clipboard_tool, _clipboard_package = 'Wayland', 'wl-copy', 'wl-clipboard'
elif 'DISPLAY' in environ:
+8 -9
View File
@@ -8,26 +8,25 @@ arguments = argv[1:]
# define replacement text depending on arguments
if len(arguments) > 0:
if arguments[0] == 'WSL':
replacement = """run(['powershell.exe', '-c', "Set-Clipboard '" + _copy_subject.rstrip()\
.replace("'", "''") + "'"])
replacement = """run(('powershell.exe', '-c', "Set-Clipboard '" + _copy_subject.replace("'", "''") + "'"))
Popen("sleep 30; powershell.exe -c Set-Clipboard ''", shell=True, stdout=DEVNULL, stderr=DEVNULL)"""
elif arguments[0] == 'MAC':
replacement = """run(['pbcopy'], stdin=Popen(['printf', _copy_subject.rstrip()\
.replace('\\\\\\', '\\\\\\\\\\\\\\').replace('%', '%%')],stdout=PIPE).stdout)
replacement = """run('pbcopy', stdin=Popen(('printf', _copy_subject.replace('\\\\\\', '\\\\\\\\\\\\\\')
.replace('%', '%%')), stdout=PIPE).stdout)
Popen("sleep 30; printf '' | pbcopy", shell=True)"""
elif arguments[0] == 'HAIKU':
replacement = """run(['clipboard', '-c', _copy_subject.rstrip()])
replacement = """run(('clipboard', '-c', _copy_subject))
Popen('sleep 30; clipboard -r', shell=True)"""
elif arguments[0] == 'TERMUX':
replacement = """run(['termux-clipboard-set', _copy_subject.rstrip()])
replacement = """run(('termux-clipboard-set', _copy_subject))
Popen("sleep 30; termux-clipboard-set ''", shell=True)"""
elif arguments[0] == 'LINUX':
replacement = """if 'WAYLAND_DISPLAY' in environ:
run(['wl-copy', _copy_subject.rstrip()])
run(('wl-copy', _copy_subject))
Popen('sleep 30; wl-copy -c', shell=True)
else:
run(['xclip', '-sel', 'c'], stdin=Popen(['printf', _copy_subject.rstrip()\
.replace('\\\\\\', '\\\\\\\\\\\\\\').replace('%', '%%')], stdout=PIPE).stdout)
run(('xclip', '-sel', 'c'), stdin=Popen(('printf', _copy_subject
.replace('\\\\\\', '\\\\\\\\\\\\\\').replace('%', '%%')), stdout=PIPE).stdout)
Popen("sleep 30; printf '' | xclip -sel c", shell=True)"""
else:
s_exit()
+1 -1
View File
@@ -13,7 +13,7 @@ string2 = '# PORT END CLIPTOOL'
if len(arguments) > 0:
regex = re.compile(f"{string1}.*?{string2}", re.DOTALL)
replacement = """# check for clipboard tool and display warning if missing
_display_server = None
_display_server, _clipboard_tool, _clipboard_package = None, None, None
if 'WAYLAND_DISPLAY' in environ:
_display_server, _clipboard_tool, _clipboard_package = 'Wayland', 'wl-copy', 'wl-clipboard'
elif 'DISPLAY' in environ: