diff --git a/plugin/preload.js b/plugin/preload.js index e1d60f1..a13495b 100644 --- a/plugin/preload.js +++ b/plugin/preload.js @@ -162,6 +162,11 @@ window.quickcommand = { let local = path.join(root, require('crypto').createHash('md5').update(url).digest('hex')) if (forceUpdate || !fs.existsSync(local)) await this.downloadFile(remote, local) return require(local) + }, + + // 唤醒 uTools + wakeUtools: function() { + child_process.exec(process.execPath, () => {}) } } diff --git a/src/plugins/monaco/types/quickcommand.api.d.ts b/src/plugins/monaco/types/quickcommand.api.d.ts index db38866..9c6765c 100644 --- a/src/plugins/monaco/types/quickcommand.api.d.ts +++ b/src/plugins/monaco/types/quickcommand.api.d.ts @@ -301,6 +301,15 @@ interface quickcommandApi { * 模拟粘贴操作 */ simulatePaste(); + + /** + * 唤醒 uTools + * + * 当插件自身已经退出时,utools.showMainWindow() 将不再起作用 + * + * 此时可以用此接口呼出 uTools 窗口 + */ + wakeUtools(); } declare var quickcommand: quickcommandApi;