codesnippetjavascript

// open -a AppName
const openObsidianCmd = new Deno.Command('open', { args: ['-a', 'Obsidian'] })
// The below line runs the command and opens the app
const exitCode = openObsidianCmd.outputSync().code
 
// killall AppName
const closeObsidianCmd = new Deno.Command('killall', { args: ['Obsidian'] })
const exitCode = closeObsidianCmd.outputSync().code