From 6a2b11bdb96360da71b46bca0508fcc7720092c8 Mon Sep 17 00:00:00 2001 From: Sun Knudsen Date: Sun, 7 Apr 2019 05:38:36 -0400 Subject: [PATCH] Add `background` option for macOS (#126) Fixes #3 Co-authored-by: Sindre Sorhus --- index.js | 5 +++++ readme.md | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/index.js b/index.js index 3daa162..e2bbc05 100644 --- a/index.js +++ b/index.js @@ -20,6 +20,7 @@ module.exports = async (target, options) => { options = { wait: false, + background: false, ...options }; @@ -40,6 +41,10 @@ module.exports = async (target, options) => { cliArguments.push('-W'); } + if (options.background) { + cliArguments.push('--background'); + } + if (options.app) { cliArguments.push('-a', options.app); } diff --git a/readme.md b/readme.md index 160b743..1b38ec1 100644 --- a/readme.md +++ b/readme.md @@ -76,6 +76,13 @@ Note that it waits for the app to exit, not just for the window to close. On Windows, you have to explicitly specify an app for it to be able to wait. +##### background (macOS only) + +Type: `boolean`
+Default: `false` + +Do not bring the app to the foreground. + ##### app Type: `string | string[]`