Skip to content

Instantly share code, notes, and snippets.

@CorradoLanera
Last active August 27, 2022 02:32
Show Gist options
  • Save CorradoLanera/1bfa199fe347d45a25a93058053fbf11 to your computer and use it in GitHub Desktop.
Save CorradoLanera/1bfa199fe347d45a25a93058053fbf11 to your computer and use it in GitHub Desktop.
I have finally found the Windows progress bar hidden algorithm!!
update_windows <- function() {
pb <- progress::progress_bar$new(
total = 100,
format = "(:spin) :what [:bar] :perc",
clear = FALSE,
width = 80
)
i <- 1
p <- numeric(1)
usethis::ui_info("Windows is updating")
usethis::ui_info(
"Updates are underway to keep things running smootly!"
)
usethis::ui_todo(
"Please, keep your computer on and plugged in."
)
on.exit({
cat("\n")
usethis::ui_done("Updates completed!")
Sys.sleep(3)
usethis::ui_stop("NO PANIC!")
})
while (TRUE) {
p[[1L]] <- round(1 - 1/i, 2 + log10(i))
pb$update(
p,
tokens = list(
what = "We are quite there!",
perc = paste0(100 * p, "%")
)
)
Sys.sleep(0.4)
i[[1L]] <- i[[1L]] + 1L
}
}
update_windows()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment