Skip to content

frontend: Hide Twitch docks on minimized start#13368

Open
BeekeeperAlex wants to merge 1 commit intoobsproject:masterfrom
BeekeeperAlex:fix/twitch-docks-start-hidden
Open

frontend: Hide Twitch docks on minimized start#13368
BeekeeperAlex wants to merge 1 commit intoobsproject:masterfrom
BeekeeperAlex:fix/twitch-docks-start-hidden

Conversation

@BeekeeperAlex
Copy link
Copy Markdown

@BeekeeperAlex BeekeeperAlex commented Apr 28, 2026

Fixes the bug discussed here: https://obsproject.com/forum/threads/docks-reset-each-time-when-i-launch-obs-after-new-update-29.164196/

Description

When OBS is set to "Minimize to system tray when started" the Twitch integration dockable windows are all forced into view, floating and unhidden. Manually minimizing OBS does not have this problem as even undocked floating windows completely outside of the main OBS window will still correctly hide themselves. Only when OBS is set to start minimized do these Twitch dockable windows force themselves into a visible floating state while the rest of OBS is minimized as it should be.

This change records the intended visibility of the Twitch docks during minimized startup, hides them while OBS remains hidden, and restores their saved visibility when OBS is actually shown.

Motivation and Context

Twitch dock windows should follow the same hidden state as the main OBS window during startup minimized to tray, matching the behavior users already get when minimizing OBS manually after startup.

Other stream platform integration docks did not show the same minimized-start behavior in stable OBS. This patch stays limited to Twitch because Twitch creates its integration docks through a separate delayed dock-loading path.

How Has This Been Tested?

Reproduced the issue on stable OBS for Windows with Twitch connected and "Minimize to system tray when started" enabled.

Verified on stable OBS that manually minimizing OBS hides floating Twitch docks and restores them as floating when OBS is restored, so the issue is specific to minimized startup rather than normal floating dock behavior.

I have not been able to runtime-test this exact PR artifact. Fork PR Windows artifacts are built without Twitch integration support because TWITCH_CLIENTID and TWITCH_HASH are unavailable to untrusted fork PR builds. The resulting artifact only exposes stream-key setup and does not include Twitch OAuth or Twitch docks. Runtime validation needs a maintainer/CI build with the OBS Twitch credentials enabled.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • I have read the contributing document.
  • My code has been run through clang-format.
  • My code follows the project's style guidelines
  • My code is not on the master branch.
  • My code has been tested. (runtime validation needs a build with Twitch credentials enabled; see above)
  • All commit messages are properly formatted and commits squashed where appropriate.
  • I have included updates to all appropriate documentation.

@BeekeeperAlex BeekeeperAlex deleted the fix/twitch-docks-start-hidden branch April 28, 2026 01:21
@BeekeeperAlex BeekeeperAlex restored the fix/twitch-docks-start-hidden branch April 28, 2026 01:22
@BeekeeperAlex BeekeeperAlex reopened this Apr 28, 2026
@Fenrirthviti
Copy link
Copy Markdown
Member

What is different between the non-Twitch integration docks that necessitates this kind of workaround? Why are we hacking in setting the docks to hidden instead of fixing the root of the problem?

@BeekeeperAlex
Copy link
Copy Markdown
Author

BeekeeperAlex commented Apr 28, 2026

Fair. I focused on Twitch because that is where I could reproduce it, and Twitch’s delayed secondary dock loading made the behavior obvious, but I agree there is a deeper issue. This is my first PR so I was a little timid to go deeper and make a wider change.

The root issue appears to be that service/browser docks can be created/restored while OBS intentionally never calls show() during minimized-to-tray startup. If those docks restore as floating/top-level windows, they can become visible even though the main window is hidden.

I’ll push my original fix that handles hidden startup at the OBSBasic/extra-dock level.

@BeekeeperAlex
Copy link
Copy Markdown
Author

Okay I pushed my original fix from before I decided to keep my changes more local to the symptom I can actually reproduce. Obviously this hits a wider surface, but I do believe it's the real fix. Just hard to test without a build artifiact that has those features enabled.

Copy link
Copy Markdown
Author

@BeekeeperAlex BeekeeperAlex left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding a few notes on the choices here.

bool sysTrayWhenStarted = config_get_bool(App()->GetUserConfig(), "BasicWindow", "SysTrayWhenStarted");
bool hideWindowOnStart = QSystemTrayIcon::isSystemTrayAvailable() && sysTrayEnabled &&
(opt_minimize_tray || sysTrayWhenStarted);
deferExtraDockVisibility = hideWindowOnStart;
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reuse the same startup-hidden condition so docks know OBS is intentionally hidden, not just mid-startup.

return;
}

deferredExtraDockVisibility.append({dock, dock->isVisible()});
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Record the restored visibility before hiding, so floating docks come back exactly as saved once OBS is shown.

QByteArray dockState = QByteArray::fromBase64(QByteArray(dockStateStr));

if (main->isVisible() || !main->isMaximized())
if (main->IsDeferringExtraDockVisibility() || main->isVisible() || !main->isMaximized())
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Twitch loads these panes late, so we still need to restore their saved layout before the generic dock hiding kicks in.

@BeekeeperAlex BeekeeperAlex force-pushed the fix/twitch-docks-start-hidden branch from 2f44fcf to 76d0cce Compare April 28, 2026 02:50
@BeekeeperAlex BeekeeperAlex force-pushed the fix/twitch-docks-start-hidden branch from 76d0cce to ebe4dbe Compare April 28, 2026 03:11
@PatTheMav
Copy link
Copy Markdown
Member

If I'm not mistaken this other PR would consider the wrong behaviour identified by this PR as "desired" behaviour and would like to extend it to docks generally: #13325.

@BeekeeperAlex
Copy link
Copy Markdown
Author

BeekeeperAlex commented Apr 28, 2026

Having the docks show even though I've set the app to start minimized is desired behavior? Also when this bug happens it destroys the user's saved dock layout. Since they were forced to show floating even if you had docked them, they then remember they are floating and stay that way. You can see several years of frustration by users in the thread I linked. They're even installing plugins to save dock layouts just so they can click a button to restore their actual layout after this bug destroys it.

https://obsproject.com/forum/threads/docks-reset-each-time-when-i-launch-obs-after-new-update-29.164196/

And it's definitely a pain point for me as I'm using OBS as a replay buffer that I want to start with windows and stay out of the way, but instead I have to close all the floating dock windows on every startup. Then later I have to re-enable the docks and re-dock them the way I want them when I actually need them.

@PatTheMav
Copy link
Copy Markdown
Member

Just making an official note that this PR will be considered despite not being able to check the "has been tested" list item due to the valid reason stated in the OP.

@WizardCM WizardCM added the kind/bug Categorizes issue or PR as related to a bug. label May 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/bug Categorizes issue or PR as related to a bug.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants