Skip to content

Instantly share code, notes, and snippets.

@ansidev
Last active June 12, 2023 08:03
Show Gist options
  • Save ansidev/23466f69f0ef7e26205cf829a8272fce to your computer and use it in GitHub Desktop.
Save ansidev/23466f69f0ef7e26205cf829a8272fce to your computer and use it in GitHub Desktop.
Open with WezTerm
function run(input, parameters) {
let dir = input.toString();
const app = Application.currentApplication();
app.includeStandardAdditions = true;
const appName = "WezTerm";
const wezTermApp = Application(appName);
if (wezTermApp.running()) {
app.doShellScript(`/usr/local/bin/wezterm cli spawn --cwd "${dir}"`);
app.doShellScript(`osascript -e 'activate application "${appName}"'`);
} else {
app.doShellScript(`/usr/local/bin/wezterm start --cwd "${dir}"`);
}
return input;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment