From facb0b6d69095458fd4389cfb83fbbb5dd3d011c Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sat, 4 Feb 2012 23:56:03 +0100 Subject: Add docu for config file support and fix auto text bugs --- CHANGELOG | 1 + loadbars | 24 +++++++++++++++++------- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 7c432de..78743dd 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,4 +1,5 @@ * Add config file support (~/.loadbarsrc) +* Remove --title option (no need anyway) * Some bugfixes Sat Feb 4 10:56:27 CET 2012 diff --git a/loadbars b/loadbars index b0d814f..c842ecd 100755 --- a/loadbars +++ b/loadbars @@ -69,17 +69,17 @@ my %I : shared; # Setting defaults %C = ( average => 15, + barwidth => 35, + extended => 0, + factor => 1, + height => 230, + maxwidth => 1280, + samples => 500, showcores => 0, showmem => 0, - factor => 1, - extended => 0, showtext => 1, showtexthost => 0, - samples => 500, sshopts => '', - barwidth => 35, - maxwidth => 1280, - height => 230, ); %I = ( @@ -149,6 +149,8 @@ sub read_config () { next if /^[\t\s]*#/; s/[\t\s]*#.*//; + next unless length; + my ($key, $val) = split /=/, $_; trim $key; trim $val; @@ -319,7 +321,7 @@ sub auto_off_text ($) { my ($barwidth) = @_; if ($barwidth < $C{barwidth} - 1 && $I{showtextoff} == 0) { - return if $C{showtext} == 0; + return unless $C{showtext}; display_warn 'Disabling text display, text does not fit into window. Use \'t\' to re-enable.'; $I{showtextoff} = 1; $C{showtext} = 0; @@ -847,6 +849,14 @@ Memory stuff: Color: Dark grey Swp: System swap usage in % Color: Grey +Config file support: + Loadbars tries to read ~/.loadbarsrc and it's possible to configure any + option you find in --help but without leading '--'. For comments just use + the '#' sign. Sample config: + showcores=1 # Always show cores on startup + showtext=0 # Always don't display text on startup + extended=1 # Always use extended mode on startup + will always show all CPU cores in extended mode but no text display. Examples: loadbars --extended 1 --showcores 1 --height 300 --hosts localhost loadbars --hosts localhost,server1.example.com,server2.example.com -- cgit v1.2.3