Skip to content

Conversation

@vandabbin
Copy link
Contributor

@vandabbin vandabbin commented Jan 21, 2026

Fixes: #1498 #1500

This PR is a better version of the previous fix that had to be reverted for the fast metric updates when show/hiding box and cycling presets.

The previous fix had an issue where if the box had not been viewed since opening btop then it would not populate all the data and the box could take longer then it should to open.

This new fix prevents that by keeping track of the boxes that have been seen since btop started.

It also removes the global Proc::resized variable that was used in Draw::calcSizes and replaces it with a boolean argument for Draw::calcSizes that default to true if it is not included. I think this is cleaner.

What this fixes:

  • Rapidly opening and closing a box or cycling the presets will not cause the metrics to update
  • If a box has not previously been opened since btop was started then a metric update is triggered for that box when it is shown
    • This prevents the issue caused by the old fix.
    • It does this by running Runner::run() for each newly seen box with no_update set to false and redraw set to false
  • If boxes are shown or hidden and the proc box is already visible. The proc cpu graphs do not briefly vanish.
    • likewise when the Terminal window is resized this does the same thing.
  • Not clearing proc graphs if the proc box is still shown breaks the graphs when cycling presets if the graph symbol changes. This now clears the proc graphs if cycling presets and the proc graph symbol changes to prevent that.

What this does not fix:

  • Toggling options rapidly in the menu continues to update metrics too fast
    • I am still working out the best solution for this.
  • If the proc box was previously shown but is not shown now and then is toggled on the proc graphs do not immediately appear.
    • This happens because if the proc box is hidden then the proc graphs clear like before but when it is shown again they need time to update.
    • I don't have a good solution for this yet.
    • I need to look more into how those graphs work to prevent it.
Example Video (Shows fix for newly opened boxes)
Screen.Recording.2026-01-21.at.12.18.33.PM.mov

@vandabbin vandabbin force-pushed the fix-fast-update-metrics branch 5 times, most recently from d8e68f0 to 0465f1e Compare January 21, 2026 19:15
@vandabbin vandabbin changed the title improved fix for metric updates for redraw improved fix for metric updates during view change Jan 21, 2026
vandabbin added a commit to vandabbin/btop that referenced this pull request Jan 21, 2026
vandabbin added a commit to vandabbin/btop that referenced this pull request Jan 21, 2026
vandabbin added a commit to vandabbin/btop that referenced this pull request Jan 21, 2026
@vandabbin vandabbin marked this pull request as draft January 21, 2026 21:12
@vandabbin vandabbin force-pushed the fix-fast-update-metrics branch from 0465f1e to 4654e9b Compare January 21, 2026 21:30
@vandabbin vandabbin marked this pull request as ready for review January 21, 2026 21:30
@vandabbin vandabbin force-pushed the fix-fast-update-metrics branch 2 times, most recently from 2585210 to 14d85bc Compare January 21, 2026 22:50
@vandabbin vandabbin marked this pull request as draft January 21, 2026 23:17
@vandabbin
Copy link
Contributor Author

vandabbin commented Jan 21, 2026

I will mark this as ready after I figure out a solution for the proc graphs and the menu

Currently the proc graphs vanishing are the only problem I have to really figure out for the menu. The modifications I currently have for it work for the most part, but do this by doing collection update for any options that change the proc graphs symbols. This isn't great in my opinion so I'd really like to figure out a way to get the proc graphs symbols to change properly without a collection update like all the other graphs do. If I can't manage that I think just getting the process CPU percentages to not shift to the left when the graphs briefly vanish could be good enough.

@vandabbin vandabbin force-pushed the fix-fast-update-metrics branch from 14d85bc to d24c555 Compare January 24, 2026 09:47
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

Successfully merging this pull request may close these issues.

1 participant