From 1ad159c81eed3c33c85b9de000f131464dc7ecf2 Mon Sep 17 00:00:00 2001 From: Nicolas Bonifas Date: Sun, 11 Oct 2009 16:12:28 +0200 Subject: [PATCH] Restore --dontblink option --- src/draw.c | 3 ++- src/main.c | 6 ++++++ src/main.h | 5 +++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/draw.c b/src/draw.c index 42684a7..7f45904 100644 --- a/src/draw.c +++ b/src/draw.c @@ -185,7 +185,8 @@ void draw_cpuload() /* blinking CPULOAD */ draw_area(0, 117 + (lastCpuLoad == 100 ? 7 : 0), 37, 7, 4, 27); - lastCpuLoad = (lastCpuLoad == 100 ? 101 : 100); + if (!args_dontBlink100) + lastCpuLoad = (lastCpuLoad == 100 ? 101 : 100); /* drawing number <1> */ draw_area(4, 71, 4, 7, 44, 27); diff --git a/src/main.c b/src/main.c index 3fd524a..bd769e4 100644 --- a/src/main.c +++ b/src/main.c @@ -36,6 +36,7 @@ struct power_str powerState; short args_shutdownDelay = AUTOSHUTDOWN_LEAVE; char args_autoAlarm = AUTOALARM_LEAVE; bool args_beQuiet = ARGSDEF_LEAVE; + bool args_dontBlink100 = ARGSDEF_DONTBLINK100; double powerrate = 1; double cap_total = 0; @@ -113,6 +114,7 @@ void usage(char *prog, char *unknowOpt) fprintf(stderr, "\n"); fprintf(stderr, "[X-options]:\n"); fprintf(stderr, " --display=NAME set the display to open\n"); + fprintf( stderr, " --dontblink if you dont want to see \"CPULOAD\" blinking at 100%%\n"); fprintf(stderr, "[AUTOSCRIPT-options]:\n"); fprintf(stderr, " --auto-shutdown=off|N enable autoshutdown when battery percentage is at\n"); fprintf(stderr, " N%% (and AC adapter is not plugged in), or disable\n"); @@ -162,6 +164,10 @@ void setArgs(int argc, char **argv) args_XDisplayName++; continue; } + if(!strcmp(argv[i], "--dontblink")){ + args_dontBlink100 = true; + continue; + } if(!strncmp(argv[i], "--auto-shutdown=", 16)) { EXIT_IF_ALREADY_SET( args_autoShutdown, AUTOSHUTDOWN_LEAVE, "autoShutDown" ); if(!strcmp( &argv[i][16], "off")) diff --git a/src/main.h b/src/main.h index 35d60bc..758edb4 100644 --- a/src/main.h +++ b/src/main.h @@ -325,6 +325,11 @@ extern short args_shutdownDelay; extern char args_autoAlarm; +/* don't blink when we are at 100 cpuload (by Daniel Winkler) */ +#define ARGSDEF_DONTBLINK100 false + +extern bool args_dontBlink100; + /* don't print messages and warnings */ #ifndef ARGSDEF_BEQUIET #define ARGSDEF_BEQUIET false -- 2.11.4.GIT