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

Network does not follow the horizontal rule #1461

Open
holmes1d opened this issue Oct 16, 2024 · 1 comment
Open

Network does not follow the horizontal rule #1461

holmes1d opened this issue Oct 16, 2024 · 1 comment

Comments

@holmes1d
Copy link
Contributor

Describe the bug
When the network variable is added to a horizontal config it will always appear on a new row and not inline.

List relevant hardware/software information

  • Fedora 40
  • MangoHud version 0.7.2
  • GPU AMD 7900XT (Mesa 24.2.4)

To Reproduce
Steps to reproduce the behavior:

  1. Add horizontal and network variables to the config
  2. Network will always show on a new row below even if there is space on the first row

Expected behavior
I would expect the network information to appear in the same horizontal bar if space is available

Screenshots
Network forced to new row
network-new-row
If network changed to code below
network-same-row

Additional context
Changed the hub_elements.cpp to the following for fix

void HudElements::network() {
#ifdef __linux__
    if (HUDElements.net && HUDElements.net->should_reset)
        HUDElements.net.reset(new Net);

    if (!HUDElements.net)
        HUDElements.net = std::make_unique<Net>();

    for (auto& iface : HUDElements.net->interfaces){
        ImguiNextColumnFirstItem();
        HUDElements.TextColored(HUDElements.colors.network, "%.8s", iface.name.c_str());
        ImguiNextColumnOrNewRow();
        right_aligned_text(HUDElements.colors.text, HUDElements.ralign_width, "%.0f", iface.txBps / 1000.f);
        ImGui::SameLine(0,1.0f);
        ImGui::PushFont(HUDElements.sw_stats->font1);
        HUDElements.TextColored(HUDElements.colors.text, "KB/s %s", ICON_FK_ARROW_UP);
        ImGui::PopFont();
        ImguiNextColumnOrNewRow();
        right_aligned_text(HUDElements.colors.text, HUDElements.ralign_width, "%.0f", iface.rxBps / 1000.f);
        ImGui::SameLine(0,1.0f);
        ImGui::PushFont(HUDElements.sw_stats->font1);
        HUDElements.TextColored(HUDElements.colors.text, "KB/s %s", ICON_FK_ARROW_DOWN);
        ImGui::PopFont();
    }
#endif
}
@flightlessmango
Copy link
Owner

Your changes look good, feel free to make a PR

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

No branches or pull requests

2 participants