import { execFile } from 'child_process' ; import type { AppId } from '../../config/apps' ; import { apps } from '../../config/apps' ; export function openApp ( appId , url , isAlt , isShift ) { const selectedApp = apps [ appId ] ; const processedUrlTemplate = 'urlTemplate' in selectedApp ? selectedApp . urlTemplate . replace ( /\{\{URL\}\}/u , url ) : url ; const openArguments = [ '-b' , appId , isAlt ? '--background' : [ ] , isShift && 'privateArg' in selectedApp ? [ '--new' , '--args' , selectedApp . privateArg ] : [ ] , processedUrlTemplate , ] . filter ( Boolean ) . flat ( ) ; execFile ( 'open' , openArguments ) ; }