diff --git a/src/config.cpp b/src/config.cpp index dfa7399a..d8e93a46 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -328,6 +328,7 @@ namespace config { video_t video { false, // headless_mode false, // follow_client_hdr + true, // set_vdisplay_primary 28, // qp 0, // hevc_mode @@ -983,6 +984,7 @@ namespace config { bool_f(vars, "headless_mode", video.headless_mode); bool_f(vars, "follow_client_hdr", video.follow_client_hdr); + bool_f(vars, "set_vdisplay_primary", video.set_vdisplay_primary); int_f(vars, "qp", video.qp); int_f(vars, "min_threads", video.min_threads); int_between_f(vars, "hevc_mode", video.hevc_mode, { 0, 3 }); diff --git a/src/config.h b/src/config.h index 8d57bf28..144a076a 100644 --- a/src/config.h +++ b/src/config.h @@ -17,6 +17,7 @@ namespace config { struct video_t { bool headless_mode; bool follow_client_hdr; + bool set_vdisplay_primary; // ffmpeg params int qp; // higher == more compression and less quality diff --git a/src/process.cpp b/src/process.cpp index ab42ca5c..f0461c50 100644 --- a/src/process.cpp +++ b/src/process.cpp @@ -229,20 +229,29 @@ namespace proc { VDISPLAY::changeDisplaySettings(vdisplayName.c_str(), render_width, render_height, launch_session->fps); } - // Determine if we need to set the virtual display as primary - bool shouldSetPrimary = false; + bool shouldActuallySetPrimary = false; - if (launch_session->virtual_display || _app.virtual_display_primary) { - shouldSetPrimary = (currentPrimaryDisplayName != vdisplayName); + // Determine if we need to set the virtual display as primary + // Client request overrides local config + bool shouldSetVDisplayPrimary = launch_session->virtual_display; + if (!shouldSetVDisplayPrimary) { + // App config overrides global config + if (_app.virtual_display) { + shouldSetVDisplayPrimary = _app.virtual_display_primary; + } else { + shouldSetVDisplayPrimary = config::video.set_vdisplay_primary; + } + } + + if (shouldSetVDisplayPrimary) { + shouldActuallySetPrimary = (currentPrimaryDisplayName != vdisplayName); } else { - shouldSetPrimary = (currentPrimaryDisplayName != prevPrimaryDisplayName); + shouldActuallySetPrimary = (currentPrimaryDisplayName != prevPrimaryDisplayName); } // Set primary display if needed - if (shouldSetPrimary) { - auto disp = (launch_session->virtual_display || _app.virtual_display_primary) - ? vdisplayName - : prevPrimaryDisplayName; + if (shouldActuallySetPrimary) { + auto disp = shouldSetVDisplayPrimary ? vdisplayName : prevPrimaryDisplayName; BOOST_LOG(info) << "Setting display " << disp << " primary!!!"; VDISPLAY::setPrimaryDisplay(disp.c_str()); diff --git a/src_assets/common/assets/web/config.html b/src_assets/common/assets/web/config.html index cbdd9ab1..5e45c806 100644 --- a/src_assets/common/assets/web/config.html +++ b/src_assets/common/assets/web/config.html @@ -183,6 +183,9 @@ "auto_capture_sink": "enabled", "adapter_name": "", "output_name": "", + "headless_mode": "disabled", + "fallback_mode": "", + "set_vdisplay_primary": "enabled", "min_fps_factor": 1, }, }, diff --git a/src_assets/common/assets/web/configs/tabs/AudioVideo.vue b/src_assets/common/assets/web/configs/tabs/AudioVideo.vue index d591f40a..67bf0681 100644 --- a/src_assets/common/assets/web/configs/tabs/AudioVideo.vue +++ b/src_assets/common/assets/web/configs/tabs/AudioVideo.vue @@ -135,13 +135,21 @@ const validateFallbackMode = (event) => {
{{ $t('config.follow_client_hdr_desc') }}
- +
- +
{{ $t('config.headless_mode_desc') }}
+ +
+ + +
{{ $t('config.set_vdisplay_primary_desc') }}
+
+ +
SudoVDA Driver status: {{currentDriverStatus}}
diff --git a/src_assets/common/assets/web/public/assets/locale/en.json b/src_assets/common/assets/web/public/assets/locale/en.json index c11e53c9..07a58cab 100644 --- a/src_assets/common/assets/web/public/assets/locale/en.json +++ b/src_assets/common/assets/web/public/assets/locale/en.json @@ -82,14 +82,14 @@ "name": "Name", "output_desc": "The file where the output of the command is stored, if it is not specified, the output is ignored", "output_name": "Output", - "run_as_desc": "This can be necessary for some applications that require administrator permissions to run properly.", + "run_as_desc": "This can be necessary for some applications that require administrator permissions to run properly. Might cause URL schemes to fail.", "wait_all": "Continue streaming until all app processes exit", "wait_all_desc": "This will continue streaming until all processes started by the app have terminated. When unchecked, streaming will stop when the initial app process exits, even if other app processes are still running.", "working_dir": "Working Directory", "working_dir_desc": "The working directory that should be passed to the process. For example, some applications use the working directory to search for configuration files. If not set, Apollo will default to the parent directory of the command", "virtual_display": "Always use Virtual Display", "virtual_display_desc": "Always use virtual display on this app, overriding client request. Please make sure the SudoVDA driver is installed and enabled.", - "virtual_display_primary": "Set virtual display as primary display", + "virtual_display_primary": "Enforce Virtual Display Primary", "virtual_display_primary_desc": "Automatically set the virtual display as primary display when the app starts. Virtual display will always be set to primary when client requests to use virtual display. (Recommended to keep on)", "resolution_scale_factor": "Resolution Scale Factor", "resolution_scale_factor_desc": "Scale the client requested resolution based on this factor. e.g. 2000x1000 with a factor of 120% will become 2400x1200. Overrides client requested factor when the number isn't 100%. This option won't affect client requested streaming resolution." @@ -322,6 +322,8 @@ "restart_note": "Apollo is restarting to apply changes.", "server_cmd": "Server Commands", "server_cmd_desc": "Configure a list of commands to be executed when called from client during streaming.", + "set_vdisplay_primary": "Enforce Virtual Display Primary", + "set_vdisplay_primary_desc": "Automatically set the virtual display as primary display when the app starts. Virtual display will always be set to primary when client requests to use virtual display. (Recommended to keep on)", "sunshine_name": "Apollo Name", "sunshine_name_desc": "The name displayed by Moonlight. If not specified, the PC's hostname is used", "sw_preset": "SW Presets", diff --git a/src_assets/common/assets/web/public/assets/locale/zh.json b/src_assets/common/assets/web/public/assets/locale/zh.json index b6137a60..f2b3a6f8 100644 --- a/src_assets/common/assets/web/public/assets/locale/zh.json +++ b/src_assets/common/assets/web/public/assets/locale/zh.json @@ -80,15 +80,15 @@ "name": "名称", "output_desc": "存储命令输出的文件,如果未指定,输出将被忽略", "output_name": "输出", - "run_as_desc": "这可能是某些需要管理员权限才能正常运行的应用程序所必需的。", + "run_as_desc": "这可能是某些需要管理员权限才能正常运行的应用程序所必需的。可能会导致 URL schemes 无法正常启动。", "wait_all": "继续串流直到所有应用进程退出", "wait_all_desc": "这将继续串流直到应用程序启动的所有进程终止。 当未选中时,串流将在初始应用进程终止时停止,即使其他应用进程仍在运行。", "working_dir": "工作目录", "working_dir_desc": "应传递给进程的工作目录。例如,某些应用程序使用工作目录搜索配置文件。如果不设置,Apollo 将默认使用命令的父目录", "virtual_display": "总是使用虚拟显示器", "virtual_display_desc": "在使用这个App的时候总是使用虚拟显示器,覆盖客户端请求。请确保 SudoVDA 虚拟显示器驱动已安装并启用。", - "virtual_display_primary": "设置虚拟显示器为主显示器", - "virtual_display_primary_desc": "在App启动时自动将虚拟显示器设为主显示器。当客户端请求使用虚拟显示器时将无条件设为主显示器。(推荐保持开启)", + "virtual_display_primary": "强制设置虚拟显示器为主显示器", + "virtual_display_primary_desc": "在App启动时强制将虚拟显示器设为主显示器。当客户端请求使用虚拟显示器时将无条件设为主显示器。(覆盖全局设置,推荐保持开启)", "resolution_scale_factor": "分辨率缩放比例", "resolution_scale_factor_desc": "基于此比例缩放客户端请求的分辨率。例如 2000x1000 缩放 120% 将变成 2400x1200。当此项为非 100% 时覆盖客户端请求的缩放比例。此选项不会影响客户端请求的串流分辨率。" }, @@ -322,11 +322,13 @@ "restart_note": "正在重启 Apollo 以应用更改。", "server_cmd": "服务端命令", "server_cmd_desc": "配置一个命令列表,当串流时从客户端调用。", + "set_vdisplay_primary": "强制虚拟显示为主显示", + "set_vdisplay_primary_desc": "当应用程序启动时,自动将虚拟显示设置为主显示。当客户端请求使用虚拟显示时,虚拟显示将始终设置为主显示。(建议保持开启)", "sunshine_name": "Apollo 主机名称", "sunshine_name_desc": "在 Moonlight 中显示的名称。如果未指定,则使用 PC 的主机名", "sw_preset": "软件编码预设", "sw_preset_desc": "在编码速度和压缩效率之间权衡。默认为 superfast - 超快。", - "sw_preset_fast": "快速的", + "sw_preset_fast": "fast - 快速", "sw_preset_faster": "faster - 更快", "sw_preset_medium": "medium - 中等", "sw_preset_slow": "slow - 慢",