diff --git a/README-CN.md b/README-CN.md index 86c605b..ee94e6d 100644 --- a/README-CN.md +++ b/README-CN.md @@ -95,6 +95,7 @@ Windows 及 Linux 端内部集成了 Gnirehtet, 用于提供 PC 到安卓设 - 切换键 - 主屏幕 - 返回键 +- 启动APP - 关闭屏幕(实验性) - 通知栏 - 电源键 @@ -107,7 +108,7 @@ Windows 及 Linux 端内部集成了 Gnirehtet, 用于提供 PC 到安卓设 - 执行脚本 - 计划任务 - 反向供网(Gnirehtet) -- 多屏协同 +- 多屏协同 (废弃) ## 偏好设置 @@ -222,8 +223,9 @@ Windows 及 Linux 端内部集成了 Gnirehtet, 用于提供 PC 到安卓设 22. 图形化文件管理器 ✅ 23. 浮动操作栏 ✅ 24. 增强录制功能 ✅ -25. 对设备进行分组 🚧 -26. 游戏键位映射 🚧 +25. 启动APP(多线程) ✅ +26. 对设备进行分组 🚧 +27. 游戏键位映射 🚧 ## 常见问题 diff --git a/README.md b/README.md index 0441dd4..51ccb19 100644 --- a/README.md +++ b/README.md @@ -93,6 +93,7 @@ Refer to [scrcpy/doc/shortcuts](https://github.com/Genymobile/scrcpy/blob/master - Switch - Home - Back +- Start APP - Turn off screen (experimental) - Notification - Power @@ -105,7 +106,7 @@ Refer to [scrcpy/doc/shortcuts](https://github.com/Genymobile/scrcpy/blob/master - Execution Script - Scheduled Task - Gnirehtet -- Mirror Group +- Mirror Group (discard) ## Preferences @@ -220,8 +221,9 @@ Refer to [scrcpy/doc/shortcuts](https://github.com/Genymobile/scrcpy/blob/master 22. Graphical file manager ✅ 23. Floating control bar ✅ 24. Enhanced recording ✅ -25. Device grouping 🚧 -26. Game key mapping 🚧 +25. Start APP(Multi-threaded) ✅ +26. Device grouping 🚧 +27. Game key mapping 🚧 ## FAQ diff --git a/electron/exposes/scrcpy/helper.js b/electron/exposes/scrcpy/helper.js index 71a2a0a..650b49a 100644 --- a/electron/exposes/scrcpy/helper.js +++ b/electron/exposes/scrcpy/helper.js @@ -1,3 +1,6 @@ +import appStore from '$electron/helpers/store.js' +import { replaceIP } from '$renderer/utils/index.js' + /** * Parse scrcpy app list output into structured data * @param {string} rawText - Raw text output from scrcpy --list-apps command @@ -41,3 +44,15 @@ export function parseScrcpyAppList(rawText) { return [] } } + +/** + * Get the --display-overlay value + * @param {*} serial + * @returns {string} + */ +export function getDisplayOverlay(serial) { + const value = appStore.get(`scrcpy.${replaceIP(serial)}.--display-overlay`) + || appStore.get('scrcpy.global.--display-overlay') + || '' + return value +} diff --git a/electron/exposes/scrcpy/index.js b/electron/exposes/scrcpy/index.js index 8988db9..f8865b7 100644 --- a/electron/exposes/scrcpy/index.js +++ b/electron/exposes/scrcpy/index.js @@ -2,10 +2,10 @@ import { exec as _exec, spawn } from 'node:child_process' import util from 'node:util' import { adbPath, scrcpyPath } from '$electron/configs/index.js' import appStore from '$electron/helpers/store.js' -import { replaceIP, sleep } from '$renderer/utils/index.js' +import { sleep } from '$renderer/utils/index.js' import commandHelper from '$renderer/utils/command/index.js' -import { parseScrcpyAppList } from './helper.js' +import { getDisplayOverlay, parseScrcpyAppList } from './helper.js' let adbkit @@ -128,15 +128,12 @@ async function record(serial, { title, args = '', savePath, ...options } = {}) { } async function mirrorGroup(serial, { openNum = 1, ...options } = {}) { - const overlayDisplay - = appStore.get(`scrcpy.${replaceIP(serial)}.--display-overlay`) - || appStore.get('scrcpy.global.--display-overlay') - || '1080x1920/320,secure' + const displayOverlay = getDisplayOverlay(serial) const command = `settings put global overlay_display_devices "${[ ...Array.from({ length: openNum }).keys(), ] - .map(() => overlayDisplay) + .map(() => displayOverlay) .join(';')}"` await adbkit.deviceShell(serial, command) @@ -205,7 +202,17 @@ async function getAppList(serial) { async function startApp(serial, args = {}) { let { commands, packageName, ...options } = args - commands += ` --new-display --start-app=${packageName}` + const displayOverlay = getDisplayOverlay(serial) + + commands += ` --new-display` + + if (displayOverlay) { + commands += `=${displayOverlay}` + } + + if (packageName) { + commands += ` --start-app=${packageName}` + } const res = await mirror(serial, { ...options, args: commands, signal: /display id: (\d+)/i }) diff --git a/src/components/Device/components/ControlBar/ApplicationStart/index.vue b/src/components/Device/components/ControlBar/ApplicationStart/index.vue index af9e212..71ce701 100644 --- a/src/components/Device/components/ControlBar/ApplicationStart/index.vue +++ b/src/components/Device/components/ControlBar/ApplicationStart/index.vue @@ -3,7 +3,6 @@ :hide-on-click="false" :disabled="loading || floating" max-height="300px" - @command="handleCommand" @mouseenter="getAppData" > @@ -14,6 +13,9 @@ v-for="item of options" :key="item.value" :command="item.value" + :divided="item.divided" + :icon="item.icon" + @click="handleCommand(item)" > {{ $t(item.label) }} @@ -47,6 +49,17 @@ export default { label: item.name, value: item.packageName, })) + + value.unshift({ + label: this.$t('device.control.home'), + value: '', + icon: 'HomeFilled', + }) + + if (value[1]) { + value[1].divided = true + } + return value }, }, @@ -79,10 +92,10 @@ export default { options, }) }, - async handleCommand(value) { + async handleCommand({ label, value }) { this.loading = true - const title = this.$store.device.getLabel(this.device, 'mirror') + const title = `${this.$store.device.getLabel(this.device, 'synergy')}-${label}` const commands = this.$store.preference.scrcpyParameter(this.device.id, { excludes: ['--otg', '--mouse=aoa', '--keyboard=aoa'], diff --git a/src/locales/languages/en-US.json b/src/locales/languages/en-US.json index 92220f9..8221a5d 100644 --- a/src/locales/languages/en-US.json +++ b/src/locales/languages/en-US.json @@ -135,7 +135,7 @@ "device.control.name": "Control", "device.control.more": "More Controls", - "device.control.install": "Install App", + "device.control.install": "Install APP", "device.control.install.placeholder": "Select app to install", "device.control.install.progress": "Installing app to {deviceName}...", "device.control.install.success": "Successfully installed {totalCount} apps to {deviceName}, {successCount} succeeded, {failCount} failed", @@ -294,8 +294,8 @@ "preferences.device.control-in-stop-charging.placeholder": "Stop charging when controlling", "preferences.device.control-in-stop-charging.tips": "Stop charging when controlling", "preferences.device.display-overlay.name": "Simulated Display", - "preferences.device.display-overlay.placeholder": "1080x1920/320,secure", - "preferences.device.display-overlay.tips": "Size and resolution of simulated secondary display, Mirroring group relies on this option", + "preferences.device.display-overlay.placeholder": "Device Size, Format: 1920x1080/420, 1920x1080, /240", + "preferences.device.display-overlay.tips": "Used to adjust the size and resolution of simulated auxiliary displays, launching applications and multi-screen collaboration (mirroring group) depend on this option", "preferences.window.name": "Window", "preferences.window.borderless.name": "Borderless", diff --git a/src/locales/languages/ru-RU.json b/src/locales/languages/ru-RU.json index 9f0c0f1..12a28fe 100644 --- a/src/locales/languages/ru-RU.json +++ b/src/locales/languages/ru-RU.json @@ -135,7 +135,7 @@ "device.control.name": "Управление", "device.control.more": "Дополнительные элементы управления", - "device.control.install": "Установить приложение", + "device.control.install": "Установить APP", "device.control.install.placeholder": "Выберите приложение для установки", "device.control.install.progress": "Установка приложения на {deviceName}...", "device.control.install.success": "Успешно установлено {totalCount} приложений на {deviceName}, успешно: {successCount}, неудачно: {failCount}", @@ -169,7 +169,7 @@ "device.control.reboot": "Перезагрузить", "device.control.turnScreenOff": "Выключить экран", "device.control.turnScreenOff.tips": "Отключение экрана с сохранением контроля (экспериментально): это действие создаст процесс EscrcpyHelper; при ручном завершении этого процесса экран снова включится.", - "device.control.startApp": "Start APP", + "device.control.startApp": "Запустить APP", "device.control.power": "Питание", "device.control.power.tips": "Включить/выключить экран", "device.control.notification": "Уведомление", @@ -294,8 +294,8 @@ "preferences.device.control-in-stop-charging.placeholder": "Остановить зарядку при управлении", "preferences.device.control-in-stop-charging.tips": "Остановить зарядку при управлении", "preferences.device.display-overlay.name": "Эмуляция дисплея", - "preferences.device.display-overlay.placeholder": "1080x1920/320, secure", - "preferences.device.display-overlay.tips": "Размер и разрешение эмулируемого вторичного дисплея, функция группы зеркалирования зависит от этой опции", + "preferences.device.display-overlay.placeholder": "Размер устройства, Формат: 1920x1080/420, 1920x1080, /240", + "preferences.device.display-overlay.tips": "Используется для настройки размера и разрешения симулируемых вспомогательных дисплеев, запуск приложений и многоэкранное взаимодействие (группа зеркалирования) зависят от этой опции", "preferences.window.name": "Окно", "preferences.window.borderless.name": "Без рамки", diff --git a/src/locales/languages/zh-CN.json b/src/locales/languages/zh-CN.json index 050942b..821e0d3 100644 --- a/src/locales/languages/zh-CN.json +++ b/src/locales/languages/zh-CN.json @@ -135,7 +135,7 @@ "device.control.name": "操作", "device.control.more": "设备交互", - "device.control.install": "安装应用", + "device.control.install": "安装APP", "device.control.install.placeholder": "请选择要安装的应用", "device.control.install.progress": "正在为 {deviceName} 安装应用中...", "device.control.install.success": "已成功将应用安装到 {deviceName} 中,共 {totalCount}个,成功 {successCount}个,失败 {failCount}个", @@ -169,7 +169,7 @@ "device.control.reboot": "重启设备", "device.control.turnScreenOff": "关闭屏幕", "device.control.turnScreenOff.tips": "关闭屏幕且保持控制(实验功能):此操作将创建一个 EscrcpyHelper 进程,手动关闭进程将重新打开屏幕。", - "device.control.startApp": "启动应用", + "device.control.startApp": "启动APP", "device.control.power": "电源键", "device.control.power.tips": "可以用来开启或关闭屏幕", "device.control.notification": "通知栏", @@ -294,8 +294,8 @@ "preferences.device.control-in-stop-charging.placeholder": "开启后控制设备时将禁用自动亮屏", "preferences.device.control-in-stop-charging.tips": "开启后控制设备时将禁用自动亮屏", "preferences.device.display-overlay.name": "模拟辅助显示器", - "preferences.device.display-overlay.placeholder": "1080x1920/320,secure", - "preferences.device.display-overlay.tips": "用于调整模拟辅助显示器的大小和分辨率,多屏协同(镜像组)依赖于此选项", + "preferences.device.display-overlay.placeholder": "设备大小,格式:1920x1080/420,1920x1080,/240", + "preferences.device.display-overlay.tips": "用于调整模拟辅助显示器的大小和分辨率,启动应用、多屏协同(镜像组)依赖于此选项", "preferences.window.name": "窗口控制", "preferences.window.borderless.name": "无边框模式", diff --git a/src/locales/languages/zh-TW.json b/src/locales/languages/zh-TW.json index e4dcc6b..f8fda82 100644 --- a/src/locales/languages/zh-TW.json +++ b/src/locales/languages/zh-TW.json @@ -135,7 +135,7 @@ "device.control.name": "操作", "device.control.more": "裝置互動", - "device.control.install": "安裝應用程式", + "device.control.install": "安裝APP", "device.control.install.placeholder": "請選擇要安裝的應用程式", "device.control.install.progress": "正在為 {deviceName} 安裝應用程式中...", "device.control.install.success": "已成功將應用程式安裝到 {deviceName} 中,共 {totalCount} 個,成功 {successCount} 個,失敗 {failCount} 個", @@ -169,7 +169,7 @@ "device.control.reboot": "重啟裝置", "device.control.turnScreenOff": "關閉螢幕", "device.control.turnScreenOff.tips": "關閉螢幕且保持控制(實驗功能):此操作將創建一個 EscrcpyHelper 進程,手動關閉該進程將重新打開螢幕。", - "device.control.startApp": "Start APP", + "device.control.startApp": "啟動APP", "device.control.power": "電源鍵", "device.control.power.tips": "可以用來開啟或關閉螢幕", "device.control.notification": "通知欄", @@ -294,8 +294,8 @@ "preferences.device.control-in-stop-charging.placeholder": "開啟後控制裝置時將停用自動亮螢幕", "preferences.device.control-in-stop-charging.tips": "開啟後控制裝置時將停用自動亮螢幕", "preferences.device.display-overlay.name": "模擬輔助顯示器", - "preferences.device.display-overlay.placeholder": "1080x1920/320,secure", - "preferences.device.display-overlay.tips": "用於調整模擬輔助顯示器的大小和解析度,多螢幕協同(鏡像群組)相依於此選項", + "preferences.device.display-overlay.placeholder": "設備大小,格式:1920x1080/420,1920x1080,/240", + "preferences.device.display-overlay.tips": "用於調整模擬輔助顯示器的大小和解析度,啟動應用程式、多螢幕協同(鏡像組)依賴於此選項", "preferences.window.name": "視窗控制", "preferences.window.borderless.name": "無邊框模式",