summaryrefslogtreecommitdiff
path: root/plugins/macos/macos.plugin.zsh
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/macos/macos.plugin.zsh')
-rw-r--r--plugins/macos/macos.plugin.zsh52
1 files changed, 49 insertions, 3 deletions
diff --git a/plugins/macos/macos.plugin.zsh b/plugins/macos/macos.plugin.zsh
index e27d412c8..4d73d22c3 100644
--- a/plugins/macos/macos.plugin.zsh
+++ b/plugins/macos/macos.plugin.zsh
@@ -3,8 +3,15 @@
0="${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}"
0="${${(M)0:#/*}:-$PWD/$0}"
-# Open the current directory in a Finder window
-alias ofd='open_command $PWD'
+# Open in Finder the directories passed as arguments, or the current directory if
+# no directories are passed
+function ofd {
+ if (( ! $# )); then
+ open_command $PWD
+ else
+ open_command $@
+ fi
+}
# Show/hide hidden files in the Finder
alias showfiles="defaults write com.apple.finder AppleShowAllFiles -bool true && killall Finder"
@@ -72,6 +79,19 @@ EOF
key code 36 #(presses enter)
end tell
EOF
+
+ elif [[ "$the_app" == 'Tabby' ]]; then
+ osascript >/dev/null <<EOF
+ tell application "System Events"
+ tell process "Tabby" to keystroke "t" using command down
+ end tell
+EOF
+ elif [[ "$the_app" == 'ghostty' ]]; then
+ osascript >/dev/null <<EOF
+ tell application "System Events"
+ tell process "Ghostty" to keystroke "t" using command down
+ end tell
+EOF
else
echo "$0: unsupported terminal app: $the_app" >&2
return 1
@@ -120,6 +140,18 @@ EOF
keystroke "${command} \n"
end tell
EOF
+ elif [[ "$the_app" == 'Tabby' ]]; then
+ osascript >/dev/null <<EOF
+ tell application "System Events"
+ tell process "Tabby" to keystroke "D" using command down
+ end tell
+EOF
+ elif [[ "$the_app" == 'ghostty' ]]; then
+ osascript >/dev/null <<EOF
+ tell application "System Events"
+ tell process "Ghostty" to keystroke "D" using command down
+ end tell
+EOF
else
echo "$0: unsupported terminal app: $the_app" >&2
return 1
@@ -169,6 +201,18 @@ EOF
keystroke "${command} \n"
end tell
EOF
+ elif [[ "$the_app" == 'Tabby' ]]; then
+ osascript >/dev/null <<EOF
+ tell application "System Events"
+ tell process "Tabby" to keystroke "d" using command down
+ end tell
+EOF
+ elif [[ "$the_app" == 'ghostty' ]]; then
+ osascript >/dev/null <<EOF
+ tell application "System Events"
+ tell process "Ghostty" to keystroke "d" using command down
+ end tell
+EOF
else
echo "$0: unsupported terminal app: $the_app" >&2
return 1
@@ -224,8 +268,10 @@ function quick-look() {
}
function man-preview() {
+ [[ $# -eq 0 ]] && >&2 echo "Usage: $0 command1 [command2 ...]" && return 1
+
local page
- for page in "${(@f)"$(man -w $@)"}"; do
+ for page in "${(@f)"$(command man -w $@)"}"; do
command mandoc -Tpdf $page | open -f -a Preview
done
}