From 852c2f7171adce2c264551d5d371adf595598926 Mon Sep 17 00:00:00 2001 From: Adnan Hodzic Date: Tue, 31 Dec 2019 00:37:54 +0100 Subject: [PATCH] added refresh countdown --- auto-cpufreq.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/auto-cpufreq.py b/auto-cpufreq.py index e73f061..76ebcbe 100644 --- a/auto-cpufreq.py +++ b/auto-cpufreq.py @@ -20,7 +20,6 @@ import click # - add option to enable turbo in powersave # - go thru all other ToDo's # - copy cpufreqctl script if it doesn't exist -# - add refresh timeout message (how to quit?) # global var p = psutil @@ -55,6 +54,16 @@ def root_check(): sys.exit(f"Must be run as root, i.e: \"sudo {tool_run}\"\n") exit(1) +# refresh countdown +def countdown(s): + for remaining in range(s, 0, -1): + sys.stdout.write("\r") + sys.stdout.write("\"auto-cpufreq\" refresh in:{:2d}".format(remaining)) + sys.stdout.flush() + time.sleep(1) + + sys.stdout.write("\rRefreshing ... \n") + # set powersave def set_powersave(): print("\nSetting: powersave") @@ -171,7 +180,8 @@ def cli(live, daemon): gov_check() sysinfo() autofreq() - time.sleep(10) + countdown(15) + #time.sleep(1) subprocess.call("clear") elif daemon: print("daemon ...")