From 8fe88a9b148b967e8679c57db1357a3e88af8b9d Mon Sep 17 00:00:00 2001 From: Randall Winkhart Date: Mon, 3 Apr 2023 21:43:01 -0400 Subject: [PATCH] Initial MacOS support (no packaging) Former-commit-id: 835ed80a9da57a7a40e6463f0ee822c900248e05 Former-commit-id: a3db3fbf88e8a8bcc485821a31ea4f3862a4abbf --- lib/sshyp.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/sshyp.py b/lib/sshyp.py index f75c0c1..4f8d89d 100755 --- a/lib/sshyp.py +++ b/lib/sshyp.py @@ -206,7 +206,7 @@ def tweak(): # runs configuration wizard # config directory creation Path(f"{home}/.config/sshyp/devices").mkdir(mode=0o700, parents=True, exist_ok=True) if not exists(f"{home}/.config/sshyp/tmp"): - if uname()[0] in ('Haiku', 'FreeBSD'): + if uname()[0] in ('Haiku', 'FreeBSD', 'Darwin'): symlink('/tmp', f"{home}/.config/sshyp/tmp") elif exists('/data/data/com.termux'): symlink('/data/data/com.termux/files/usr/tmp', f"{home}/.config/sshyp/tmp") @@ -706,6 +706,9 @@ def copy_data(): # copies a specified field of an entry to the clipboard elif uname()[0] == 'Haiku': # Haiku clipboard detection 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) + 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)