feat(display): Add revert display config on disconnect option (#3613)
This commit is contained in:
@@ -1203,6 +1203,31 @@ editing the `conf` file in a text editor. Use the examples as reference.
|
|||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
|
||||||
|
### dd_config_revert_on_disconnect
|
||||||
|
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<td>Description</td>
|
||||||
|
<td colspan="2">
|
||||||
|
When enabled, display configuration is reverted upon disconnect of all clients instead of app close or last session termination.
|
||||||
|
This can be useful for returning to physical usage of the host machine without closing the active app.
|
||||||
|
@warning{Some applications may not function properly when display configuration is changed while active.}
|
||||||
|
@note{Applies to Windows only.}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Default</td>
|
||||||
|
<td colspan="2">@code{}disabled@endcode</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Example</td>
|
||||||
|
<td colspan="2">@code{}
|
||||||
|
dd_config_revert_on_disconnect = enabled
|
||||||
|
@endcode</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
### dd_mode_remapping
|
### dd_mode_remapping
|
||||||
|
|
||||||
<table>
|
<table>
|
||||||
|
|||||||
@@ -504,6 +504,7 @@ namespace config {
|
|||||||
{}, // manual_refresh_rate
|
{}, // manual_refresh_rate
|
||||||
video_t::dd_t::hdr_option_e::automatic, // hdr_option
|
video_t::dd_t::hdr_option_e::automatic, // hdr_option
|
||||||
3s, // config_revert_delay
|
3s, // config_revert_delay
|
||||||
|
{}, // config_revert_on_disconnect
|
||||||
{}, // mode_remapping
|
{}, // mode_remapping
|
||||||
{} // wa
|
{} // wa
|
||||||
}, // display_device
|
}, // display_device
|
||||||
@@ -1132,6 +1133,7 @@ namespace config {
|
|||||||
video.dd.config_revert_delay = std::chrono::milliseconds {value};
|
video.dd.config_revert_delay = std::chrono::milliseconds {value};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
bool_f(vars, "dd_config_revert_on_disconnect", video.dd.config_revert_on_disconnect);
|
||||||
generic_f(vars, "dd_mode_remapping", video.dd.mode_remapping, dd::mode_remapping_from_view);
|
generic_f(vars, "dd_mode_remapping", video.dd.mode_remapping, dd::mode_remapping_from_view);
|
||||||
bool_f(vars, "dd_wa_hdr_toggle", video.dd.wa.hdr_toggle);
|
bool_f(vars, "dd_wa_hdr_toggle", video.dd.wa.hdr_toggle);
|
||||||
|
|
||||||
|
|||||||
@@ -132,6 +132,7 @@ namespace config {
|
|||||||
std::string manual_refresh_rate; ///< Manual refresh rate in case `refresh_rate_option == refresh_rate_option_e::manual`.
|
std::string manual_refresh_rate; ///< Manual refresh rate in case `refresh_rate_option == refresh_rate_option_e::manual`.
|
||||||
hdr_option_e hdr_option;
|
hdr_option_e hdr_option;
|
||||||
std::chrono::milliseconds config_revert_delay; ///< Time to wait until settings are reverted (after stream ends/app exists).
|
std::chrono::milliseconds config_revert_delay; ///< Time to wait until settings are reverted (after stream ends/app exists).
|
||||||
|
bool config_revert_on_disconnect; ///< Specify whether to revert display configuration on client disconnect.
|
||||||
mode_remapping_t mode_remapping;
|
mode_remapping_t mode_remapping;
|
||||||
workarounds_t wa;
|
workarounds_t wa;
|
||||||
} dd;
|
} dd;
|
||||||
|
|||||||
@@ -1882,11 +1882,17 @@ namespace stream {
|
|||||||
|
|
||||||
// If this is the last session, invoke the platform callbacks
|
// If this is the last session, invoke the platform callbacks
|
||||||
if (--running_sessions == 0) {
|
if (--running_sessions == 0) {
|
||||||
|
bool revert_display_config {config::video.dd.config_revert_on_disconnect};
|
||||||
if (proc::proc.running()) {
|
if (proc::proc.running()) {
|
||||||
#if defined SUNSHINE_TRAY && SUNSHINE_TRAY >= 1
|
#if defined SUNSHINE_TRAY && SUNSHINE_TRAY >= 1
|
||||||
system_tray::update_tray_pausing(proc::proc.get_last_run_app_name());
|
system_tray::update_tray_pausing(proc::proc.get_last_run_app_name());
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
|
// We have no app running and also no clients anymore.
|
||||||
|
revert_display_config = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (revert_display_config) {
|
||||||
display_device::revert_configuration();
|
display_device::revert_configuration();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -175,6 +175,7 @@
|
|||||||
"dd_manual_refresh_rate": "",
|
"dd_manual_refresh_rate": "",
|
||||||
"dd_hdr_option": "auto",
|
"dd_hdr_option": "auto",
|
||||||
"dd_config_revert_delay": 3000,
|
"dd_config_revert_delay": 3000,
|
||||||
|
"dd_config_revert_on_disconnect": "disabled",
|
||||||
"dd_mode_remapping": {"mixed": [], "resolution_only": [], "refresh_rate_only": []},
|
"dd_mode_remapping": {"mixed": [], "resolution_only": [], "refresh_rate_only": []},
|
||||||
"dd_wa_hdr_toggle": "disabled",
|
"dd_wa_hdr_toggle": "disabled",
|
||||||
"min_fps_factor": 1,
|
"min_fps_factor": 1,
|
||||||
|
|||||||
@@ -151,6 +151,15 @@ function addRemappingEntry() {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- Config revert on disconnect -->
|
||||||
|
<div class="mb-3" v-if="config.dd_configuration_option !== 'disabled'">
|
||||||
|
<Checkbox id="dd_config_revert_on_disconnect"
|
||||||
|
locale-prefix="config"
|
||||||
|
v-model="config.dd_config_revert_on_disconnect"
|
||||||
|
default="false"
|
||||||
|
></Checkbox>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- Display mode remapping -->
|
<!-- Display mode remapping -->
|
||||||
<div class="mb-3" v-if="canBeRemapped()">
|
<div class="mb-3" v-if="canBeRemapped()">
|
||||||
<label for="dd_mode_remapping" class="form-label">
|
<label for="dd_mode_remapping" class="form-label">
|
||||||
|
|||||||
@@ -158,6 +158,8 @@
|
|||||||
"dd_config_label": "Device configuration",
|
"dd_config_label": "Device configuration",
|
||||||
"dd_config_revert_delay": "Config revert delay",
|
"dd_config_revert_delay": "Config revert delay",
|
||||||
"dd_config_revert_delay_desc": "Additional delay in milliseconds to wait before reverting configuration when the app has been closed or the last session terminated. Main purpose is to provide a smoother transition when quickly switching between apps.",
|
"dd_config_revert_delay_desc": "Additional delay in milliseconds to wait before reverting configuration when the app has been closed or the last session terminated. Main purpose is to provide a smoother transition when quickly switching between apps.",
|
||||||
|
"dd_config_revert_on_disconnect": "Config revert on disconnect",
|
||||||
|
"dd_config_revert_on_disconnect_desc": "Revert configuration upon disconnect of all clients instead of app close or last session termination.",
|
||||||
"dd_config_verify_only": "Verify that the display is enabled (default)",
|
"dd_config_verify_only": "Verify that the display is enabled (default)",
|
||||||
"dd_hdr_option": "HDR",
|
"dd_hdr_option": "HDR",
|
||||||
"dd_hdr_option_auto": "Switch on/off the HDR mode as requested by the client (default)",
|
"dd_hdr_option_auto": "Switch on/off the HDR mode as requested by the client (default)",
|
||||||
|
|||||||
Reference in New Issue
Block a user