Changed method for detecting Termux

This commit is contained in:
2022-01-13 02:46:18 -05:00
parent 2825b43659
commit b0fa1f99c9
+2 -1
View File
@@ -1,6 +1,7 @@
#!/usr/bin/python3 #!/usr/bin/python3
# external modules # external modules
from os import environ, mkdir, remove, system, path from os import environ, mkdir, remove, system, path
from shutil import copy, move, rmtree from shutil import copy, move, rmtree
from sys import argv, exit as s_exit from sys import argv, exit as s_exit
@@ -339,7 +340,7 @@ def copy_data(): # copies a specified field of an entry to the clipboard
_shm_folder, _shm_entry = shm_gen() _shm_folder, _shm_entry = shm_gen()
system(f"gpg -d --output /dev/shm/{_shm_folder}/{_shm_entry} '{directory}{_read_entry}.gpg'") system(f"gpg -d --output /dev/shm/{_shm_folder}/{_shm_entry} '{directory}{_read_entry}.gpg'")
_copy_line = open(f"/dev/shm/{_shm_folder}/{_shm_entry}", 'r').readlines() _copy_line = open(f"/dev/shm/{_shm_folder}/{_shm_entry}", 'r').readlines()
if Path(f"{path.expanduser('~')}/.config/sshyp/flag_termux").is_file(): # checks for Termux, Wayland, or X if Path("/data/data/com.termux").is_file(): # checks for Termux, Wayland, or X
if argument == 'copy username' or argument == 'copy -u': if argument == 'copy username' or argument == 'copy -u':
system('termux-clipboard-set ' + "'" + _copy_line[0].replace('\n', '').replace("'", "'\\''") + "'") system('termux-clipboard-set ' + "'" + _copy_line[0].replace('\n', '').replace("'", "'\\''") + "'")
elif argument == 'copy password' or argument == 'copy -p': elif argument == 'copy password' or argument == 'copy -p':