Skip to content

Instantly share code, notes, and snippets.

@stephancasas
Created April 3, 2023 21:12
Show Gist options
  • Save stephancasas/1e1bf8071c5feedb8a60cd1cc6b82032 to your computer and use it in GitHub Desktop.
Save stephancasas/1e1bf8071c5feedb8a60cd1cc6b82032 to your computer and use it in GitHub Desktop.
Restart the macOS Sidecar session being hosted by avconferenced
#!/usr/bin/env osascript -l JavaScript
const App = Application.currentApplication();
App.includeStandardAdditions = true;
const BINARY = '/usr/libexec/avconferenced';
function run(_) {
const avconferenced = App.doShellScript(
`ps -A | grep '${BINARY}' | awk '{print $1,$4}'`,
)
.split('\r')
.map((process) => process.split(' '))
.find(([_, exec]) => exec == BINARY);
if (!avconferenced) {
return;
}
App.doShellScript(`kill -9 ${avconferenced[0]}`);
}
@stephancasas
Copy link
Author

Sidecar keeps freezing-up on my Mac, and I'm tired of having to physically disconnect/reconnect my iPad to fix it.

This JXA script locates the ongoing avconferenced process and kills it. macOS will automatically reboot the connection shortly thereafter.

I miss Monterrey. Ventura killed sidecar for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment