feat(timeout): Add --timeout-elapsed for seamless dialog chaining#1
Closed
feat(timeout): Add --timeout-elapsed for seamless dialog chaining#1
Conversation
Adds a new --timeout-elapsed flag that allows progress bar continuation across chained dialogs by specifying how much time has already elapsed. Changes: - Add timeout_elapsed field to YadData struct (yad.h) - Register --timeout-elapsed CLI option (option.c) - Update timeout_cb to initialize from elapsed value (main.c) - Calculate initial progress bar fraction from elapsed time - Update remaining time label to account for elapsed time Usage: # First dialog yad --timeout=30 --timeout-indicator=bottom # Second dialog continuing same timeout (10s elapsed) yad --timeout=30 --timeout-elapsed=10 --timeout-indicator=bottom The progress bar and remaining time label will start at the correct position based on the elapsed time, enabling smooth visual continuity when chaining multiple yad dialogs with a shared timeout budget.
Author
|
Closing in favor of upstream PR: v1cont#320 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR: Add
--timeout-elapsedfor Seamless Dialog ChainingSummary
This PR introduces a
--timeout-elapsedoption that allows yad dialogs to continue a shared timeout from a specified elapsed point. When chaining multiple dialogs in a script, this enables the progress bar to visually continue rather than restart at 100%.Problem
When chaining yad dialogs with timeouts, each dialog restarts its progress bar from the beginning. For scripts that need a single timeout budget across multiple dialogs, this creates a jarring user experience where the progress appears to "reset" at each transition.
Solution
Add
--timeout-elapsed=SECONDSto specify how much time has already passed. The progress bar and remaining time label initialize at the correct position.Example:
Changes
src/yad.htimeout_elapsedfield toYadDatastructsrc/option.c--timeout-elapsedoption, initialize to 0src/main.ctimeout_cbandcreate_dialogto use elapsed valueImplementation Details
Timer callback (
timeout_cb):initializedflag to set the starting count oncetimeout_elapsed + 1instead of hardcoded 1Progress bar initialization (
create_dialog):(timeout - elapsed) / timeoutSafety checks:
0 < elapsed < timeoutTesting
Visual tests confirm correct behavior:
--timeout=10--timeout=10 --timeout-elapsed=5--timeout=10 --timeout-elapsed=8Backward Compatibility
Fully backward compatible. Without
--timeout-elapsed, behavior is identical to before (count starts at 1, progress starts at 100%).Related
--timeoutand--timeout-indicatoroptions