Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -1203,6 +1203,31 @@ editing the `conf` file in a text editor. Use the examples as reference.
</tr>
</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

<table>
Expand Down
2 changes: 2 additions & 0 deletions src/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,7 @@ namespace config {
{}, // manual_refresh_rate
video_t::dd_t::hdr_option_e::automatic, // hdr_option
3s, // config_revert_delay
{}, // config_revert_on_disconnect
{}, // mode_remapping
{} // wa
}, // display_device
Expand Down Expand Up @@ -1132,6 +1133,7 @@ namespace config {
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);
bool_f(vars, "dd_wa_hdr_toggle", video.dd.wa.hdr_toggle);

Expand Down
1 change: 1 addition & 0 deletions src/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ namespace config {
std::string manual_refresh_rate; ///< Manual refresh rate in case `refresh_rate_option == refresh_rate_option_e::manual`.
hdr_option_e hdr_option;
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;
workarounds_t wa;
} dd;
Expand Down
6 changes: 6 additions & 0 deletions src/stream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1882,11 +1882,17 @@

// If this is the last session, invoke the platform callbacks
if (--running_sessions == 0) {
bool revert_display_config {config::video.dd.config_revert_on_disconnect};

Check warning on line 1885 in src/stream.cpp

View check run for this annotation

Codecov / codecov/patch

src/stream.cpp#L1885

Added line #L1885 was not covered by tests
if (proc::proc.running()) {
#if defined SUNSHINE_TRAY && SUNSHINE_TRAY >= 1
system_tray::update_tray_pausing(proc::proc.get_last_run_app_name());
#endif
} else {
// We have no app running and also no clients anymore.
revert_display_config = true;
}

if (revert_display_config) {
display_device::revert_configuration();
}

Expand Down
1 change: 1 addition & 0 deletions src_assets/common/assets/web/config.html
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ <h1 class="my-4">{{ $t('config.configuration') }}</h1>
"dd_manual_refresh_rate": "",
"dd_hdr_option": "auto",
"dd_config_revert_delay": 3000,
"dd_config_revert_on_disconnect": "disabled",
"dd_mode_remapping": {"mixed": [], "resolution_only": [], "refresh_rate_only": []},
"dd_wa_hdr_toggle": "disabled",
"min_fps_factor": 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,15 @@ function addRemappingEntry() {
</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 -->
<div class="mb-3" v-if="canBeRemapped()">
<label for="dd_mode_remapping" class="form-label">
Expand Down
2 changes: 2 additions & 0 deletions src_assets/common/assets/web/public/assets/locale/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,8 @@
"dd_config_label": "Device configuration",
"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_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_hdr_option": "HDR",
"dd_hdr_option_auto": "Switch on/off the HDR mode as requested by the client (default)",
Expand Down
Loading