Open jgclark opened 10 months ago
PS: This is a workaround:
$ code ~/GitHub/NotePlan-plugins/NotePlan-plugins.code-workspace
But it means I lose some of the other helpful features of app control at start/end of bunches.
The trailing % isn't actually part of VS Code's bundle ID - it's a quirk/feature of Zsh, the default shell in current MacOS. When you run a command that outputs text with no trailing newline, like mdls -r
, Zsh marks the final line with a %
sigil so you can tell there was no trailing newline. The bundle ID really is just com.microsoft.VSCode
.
Of course, that doesn't explain why com.microsoft.VSCode\n- XX
isn't working. I've done some testing of my own, and it looks like Bunch is having trouble pulling out and using the bundle ID when given the XX
instruction. I can't see the AppleScript it's running behind the scenes, but my guess is that it's trying to tell process "com.microsoft.VSCode"
rather than tell application id "com.microsoft.VSCode"
.
⚪[Close] Closing all com.microsoft.VSCode windows
🔴[Close] {
NSAppleScriptErrorAppName = "System Events";
NSAppleScriptErrorBriefMessage = "Can\U2019t get process \"com.microsoft.VSCode\".";
NSAppleScriptErrorMessage = "System Events got an error: Can\U2019t get process \"com.microsoft.VSCode\".";
NSAppleScriptErrorNumber = "-1728";
NSAppleScriptErrorRange = "NSRange: {0, 0}";
}
Unfortunately, however, I don't think there's a way to fix this and get XX
to work with Code, because Code itself doesn't understand the AppleScript command close every window
even when it's sent in the correct way:
tell application "System Events"
tell application id "com.microsoft.VSCode"
close every window
end tell
end tell
-- Visual Studio Code got an error: every window doesn’t understand the “close” message. (-1708)
I'll have to dig in and see if I'm using process
or application id
, but I don't think VSCode is going to respond to close all windows either way (it's not a standard macOS app with a scripting definition).
The hardcoded workaround may be trying to fix a problem that doesn't exist anymore if VS Code has actually fixed the issue where it needed one app name to start (Visual Studio Code) and then another app name (Code) once it was running. I'll take a look at that when I get time.
https://bunchapp.co/docs/troubleshooting/#visual-studio-code indicates that VSCode is problematic, but that you have kindly implemented a hard-code workaround.
That doesn't seem to be working for me, at least on bunch 1.4.16 (177) / macOS 13.6.3 / VSCode 1.85.2.
For
the log says
I have also tried with the following variations, none of which work.
(The middle one is apparently is its bundleID, with the %. But I tried without as well.)