summaryrefslogtreecommitdiff
path: root/plugins/xcode
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/xcode')
-rw-r--r--plugins/xcode/README.md2
-rw-r--r--plugins/xcode/xcode.plugin.zsh7
2 files changed, 7 insertions, 2 deletions
diff --git a/plugins/xcode/README.md b/plugins/xcode/README.md
index 27d6a228b..ac79f728d 100644
--- a/plugins/xcode/README.md
+++ b/plugins/xcode/README.md
@@ -1,7 +1,5 @@
# Xcode
-## Description
-
This plugin provides a few utilities that can help you on your daily use of Xcode and iOS development.
To start using it, add the `xcode` plugin to your `plugins` array in `~/.zshrc`:
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]}"
}