Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Window rule to allow client to render when unfocused / on another workspace #2701

Closed
Cloudef opened this issue Jul 13, 2023 · 14 comments · Fixed by #7582
Closed

Window rule to allow client to render when unfocused / on another workspace #2701

Cloudef opened this issue Jul 13, 2023 · 14 comments · Fixed by #7582
Labels
enhancement New feature or request
Milestone

Comments

@Cloudef
Copy link

Cloudef commented Jul 13, 2023

Useful with some games like dark souls which will disconnect you if the fps flutters too much. When running inside gamescope it can limit FPS when unfocused as well. (though not sure if this feature works in wayland?)

@Cloudef Cloudef added the enhancement New feature or request label Jul 13, 2023
@donovanglover
Copy link

+1. Current behavior breaks hitsound audio in the osu-stable editor when switching workspaces.

@tchofy
Copy link

tchofy commented Jul 16, 2023

A workaround I've been doing to get some games to behave as expected is by having OBS capture their window (without recording), but I had to downgrade OBS to 29.0.2-6 due to #2679 and hyprwm/xdg-desktop-portal-hyprland#58.

@donovanglover
Copy link

Workaround works great for me, thanks! Would love to see a window rule in Hyprland if possible.

@maxi0604
Copy link

+1. This issue has shown up for me in Factorio multiplayer, where server lag occurs for other players if the FPS of the server is too low.

@cprin21
Copy link

cprin21 commented Jun 7, 2024

+1 This issue reduces the experience of using the hyprexpo plugin as it is very clear that the inactive workspaces are not rendered, causing them to show up as freeze frames of how they were when switched away.
On a more practical level it makes gaming non-ideal due to instability caused by this issue, such as in World of Warcraft causing disconnects (using Gamescope exacerbates the frequency of disconnects).
If not entirely 'fixed', would a client (window) rule or workspace rule be a good workaround, e.g. keeping workspace 5 rendering persistently, or game's client?

@alcio1
Copy link

alcio1 commented Jul 18, 2024

+1. I'm getting disconnected when switching workspaces while playing Elden Ring.

@myned
Copy link

myned commented Jul 25, 2024

From my comment @ #3776 (comment):

I can no longer reproduce my main issue with GW2 accumulating frames @ 4beac91, so this may be fixed.
It's worth retesting affected games with aquamarine if mitigating those issues are the only reason for a [rule].

#3776 is likely a duplicate of this issue as well.

@Morbiuzx
Copy link

I get disconnected from every Souls game when I leave the game opened in an unfocused workspace, error says "Frame rate unsuitable for online play". I like games to stop rendering when switching workspaces because it lowers power consumption as the GPU is not being used when the game is unfocused, but a windowrule to control this behaviour would be nice in some cases.

@myned
Copy link

myned commented Aug 13, 2024

Can confirm that Elden Ring still detects low framerate when switching workspaces after the migration (77cf651), but other games that had issues previously with halted rendering seem to handle it better, at least. A rule to fully render in the background (not just at e.g. 1 fps) would likely still be needed for games like ER that are overactive with their cheat prevention methods, or perhaps support for minimize requests but that's another issue entirely.

@enzi
Copy link

enzi commented Aug 13, 2024

Yep, +1 to this.
A window rule would be best but I can also live with a workspace rule. I tried patching it but had no success. My basic angle was to utilize m_bForceRendering and always render workspace 5 that I set in a config. Tried 2 different angles:

One in Renderer.cpp

@@ -347,6 +347,14 @@ void CHyprRenderer::renderWorkspaceWindowsFullscreen(CMonitor* pMonitor, PHLWORK

    EMIT_HOOK_EVENT("render", RENDER_PRE_WINDOWS);

    for (auto& w : g_pCompositor->m_vWindows) {
        if (!pWorkspace->m_bForceRendering)
            continue;

        renderWindow(w, pMonitor, time, true, RENDER_PASS_ALL);
    }

    // loop over the tiled windows that are fading out
    for (auto& w : g_pCompositor->m_vWindows) {
        if (!shouldRenderWindow(w, pMonitor))

and one for Swipe.cpp

@@ -59,6 +59,7 @@ void CInputManager::endWorkspaceSwipe() {
    static auto PSWIPENEW     = CConfigValue<Hyprlang::INT>("gestures:workspace_swipe_create_new");
    static auto PSWIPEUSER    = CConfigValue<Hyprlang::INT>("gestures:workspace_swipe_use_r");
    static auto PWORKSPACEGAP = CConfigValue<Hyprlang::INT>("general:gaps_workspaces");
    static auto PFORCEDRENDERWORKSPACE = CConfigValue<Hyprlang::INT>("general:forced_render_workspace");
    const bool  VERTANIMS     = m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.getConfig()->pValues->internalStyle == "slidevert" ||
        m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.getConfig()->pValues->internalStyle.starts_with("slidefadevert");



@@ -185,7 +186,15 @@ void CInputManager::endWorkspaceSwipe() {
        PWORKSPACEL->m_bForceRendering = false;
    if (PWORKSPACER)
        PWORKSPACER->m_bForceRendering = false;
    m_sActiveSwipe.pWorkspaceBegin->m_bForceRendering = false;

    if (m_sActiveSwipe.pWorkspaceBegin->m_iID != *PFORCEDRENDERWORKSPACE)
    {
        m_sActiveSwipe.pWorkspaceBegin->m_bForceRendering = false;
    }
    else
    {
        Debug::log(LOG, "Prevented stop rendering");
    }

    m_sActiveSwipe.pWorkspaceBegin  = nullptr;
    m_sActiveSwipe.initialDirection = 0;
    ```

@ShayBox
Copy link

ShayBox commented Aug 16, 2024

Also having this issue on VRChat, audio cuts out and video players freeze, which is especially annoying because video players can't seek, so everyone watching has to restart from the beginning with me.

It would be nice if, however this is fixed, it could be applied to only certain workspaces or windows to reduce extra lag from forced rendering.

@Perfectio07
Copy link

I too would love to see this enhancement, whether as a window or workspace rule

@vaxerski
Copy link
Member

fine

@vaxerski
Copy link
Member

see #7582 needs testing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.