From fedef5dbd5f8ffef16815cb3a2c611eb0f7f00b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Wed, 11 Oct 2023 19:23:44 +0200 Subject: [PATCH] fix(xcode): open Xcode in current Desk if already open in another (#10384) Fixes #10384 --- plugins/xcode/xcode.plugin.zsh | 7 +++++++ 1 file changed, 7 insertions(+) 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]}" }