summaryrefslogtreecommitdiff
path: root/plugins/xcode/xcode.plugin.zsh
diff options
context:
space:
mode:
authorTuowen Zhao <ztuowen@gmail.com>2023-11-04 18:38:46 -0700
committerTuowen Zhao <ztuowen@gmail.com>2023-11-04 18:38:46 -0700
commit4d908094fdc2a0c0e9a0a072eba213fab7adef43 (patch)
tree7c17e70bcdeebbe96c84d849bdf17882007480d8 /plugins/xcode/xcode.plugin.zsh
parent4b0bbc0b263a150eb9a9b59f196914629be06a9b (diff)
parent632ed413a9ce62747ded83d7736491b081be4b49 (diff)
downloadzsh-master.tar.gz
zsh-master.tar.bz2
zsh-master.zip
Merge remote-tracking branch 'github/master'HEADmaster
Diffstat (limited to 'plugins/xcode/xcode.plugin.zsh')
-rw-r--r--plugins/xcode/xcode.plugin.zsh7
1 files changed, 7 insertions, 0 deletions
diff --git a/plugins/xcode/xcode.plugin.zsh b/plugins/xcode/xcode.plugin.zsh
index 5d1f901a3..f09434e69 100644
--- a/plugins/xcode/xcode.plugin.zsh
+++ b/plugins/xcode/xcode.plugin.zsh
@@ -17,6 +17,13 @@ function xc {
local active_path
active_path=${"$(xcode-select -p)"%%/Contents/Developer*}
echo "Found ${xcode_files[1]}. Opening with ${active_path}"
+
+ # If Xcode is already opened in another Desk, we need this double call
+ # with -g to open the project window in the current Desk and focus it.
+ # See https://github.com/ohmyzsh/ohmyzsh/issues/10384
+ if command pgrep -q "^Xcode"; then
+ open -g -a "$active_path" "${xcode_files[1]}"
+ fi
open -a "$active_path" "${xcode_files[1]}"
}