diff --git a/.gitignore b/.gitignore index 2f757de0..9abdfafa 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ .DS_Store .eslintcache .idea/ +*.iml .python-version /*.tgz /.env diff --git a/lib/cli/device/index.js b/lib/cli/device/index.js index d94bee53..d2ad8a37 100644 --- a/lib/cli/device/index.js +++ b/lib/cli/device/index.js @@ -108,6 +108,12 @@ module.exports.builder = function(yargs) { , type: 'number' , demand: true }) + .option('screen-reset', { + describe: 'Go back to home screen and reset screen rotation ' + + 'when user releases device. Negate with --no-screen-reset.' + , type: 'boolean' + , default: true + }) .option('screen-ws-url-pattern', { describe: 'The URL pattern to use for the screen WebSocket.' , type: 'string' @@ -165,5 +171,6 @@ module.exports.handler = function(argv) { , muteMaster: argv.muteMaster , lockRotation: argv.lockRotation , cleanup: argv.cleanup + , screenReset: argv.screenReset }) } diff --git a/lib/cli/local/index.js b/lib/cli/local/index.js index 6470dd94..11fcfb27 100644 --- a/lib/cli/local/index.js +++ b/lib/cli/local/index.js @@ -156,6 +156,12 @@ module.exports.builder = function(yargs) { , type: 'string' , default: 'localhost' }) + .option('screen-reset', { + describe: 'Go back to home screen and reset screen rotation ' + + 'when user releases device. Negate with --no-screen-reset.' + , type: 'boolean' + , default: true + }) .option('serial', { describe: 'Only use devices with these serial numbers.' , type: 'array' @@ -282,6 +288,7 @@ module.exports.handler = function(argv) { .concat(argv.allowRemote ? ['--allow-remote'] : []) .concat(argv.lockRotation ? ['--lock-rotation'] : []) .concat(!argv.cleanup ? ['--no-cleanup'] : []) + .concat(!argv.screenReset ? ['--no-screen-reset'] : []) .concat(argv.serial)) // auth diff --git a/lib/cli/provider/index.js b/lib/cli/provider/index.js index 108b2347..32dd7b4a 100644 --- a/lib/cli/provider/index.js +++ b/lib/cli/provider/index.js @@ -122,6 +122,12 @@ module.exports.builder = function(yargs) { , type: 'number' , default: 30000 }) + .option('screen-reset', { + describe: 'Go back to home screen and reset screen rotation ' + + 'when user releases device. Negate with --no-screen-reset.' + , type: 'boolean' + , default: true + }) .option('screen-ws-url-pattern', { describe: 'The URL pattern to use for the screen WebSocket.' , type: 'string' @@ -199,6 +205,7 @@ module.exports.handler = function(argv) { }, [])) .concat(argv.lockRotation ? ['--lock-rotation'] : []) .concat(!argv.cleanup ? ['--no-cleanup'] : []) + .concat(!argv.screenReset ? ['--no-screen-reset'] : []) return fork(cli, args) } diff --git a/lib/units/device/plugins/group.js b/lib/units/device/plugins/group.js index 2ebe030a..facf5f7f 100644 --- a/lib/units/device/plugins/group.js +++ b/lib/units/device/plugins/group.js @@ -104,8 +104,10 @@ module.exports = syrup.serial() }) plugin.on('leave', function() { - service.pressKey('home') - service.thawRotation() + if (options.screenReset) { + service.pressKey('home') + service.thawRotation() + } service.releaseWakeLock() })