summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Cornellà <hello@mcornella.com>2023-10-11 19:23:44 +0200
committerMarc Cornellà <hello@mcornella.com>2023-10-11 19:23:44 +0200
commitfedef5dbd5f8ffef16815cb3a2c611eb0f7f00b1 (patch)
treeb87db14d740b65285a211173e0dbd01ad7939939
parentda3b8fcb6a6bcf4d440b9768d2deab27f787929a (diff)
downloadzsh-fedef5dbd5f8ffef16815cb3a2c611eb0f7f00b1.tar.gz
zsh-fedef5dbd5f8ffef16815cb3a2c611eb0f7f00b1.tar.bz2
zsh-fedef5dbd5f8ffef16815cb3a2c611eb0f7f00b1.zip
fix(xcode): open Xcode in current Desk if already open in another (#10384)
Fixes #10384
-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]}"
}