From 7733536589b61ca15f94fc951c7160336197ef5b Mon Sep 17 00:00:00 2001 From: inxi-svn Date: Tue, 26 Apr 2011 02:09:43 +0000 Subject: [PATCH] fine tuning --- inxi | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/inxi b/inxi index 0c044c7..9a755ee 100755 --- a/inxi +++ b/inxi @@ -1,7 +1,7 @@ #!/bin/bash ######################################################################## #### Script Name: inxi -#### version: 1.4.82-b3 +#### version: 1.4.82-b4 #### Date: April 25 2011 ######################################################################## #### SPECIAL THANKS @@ -306,7 +306,7 @@ DEBUG_BUFFER_INDEX=0 DEFAULT_COLOR_SCHEME=2 # Always leave this blank, this is only going to be set in inxi.conf files, that makes testing # for user changes easier after sourcing the files -DEFAULT_COLOR_SCHEME_OVERRIDE='' +DEFAULT_TERM_COLOR_SCHEME='' # Default indentation level INDENT=10 @@ -545,10 +545,14 @@ main() # This will only trigger on first run out of irc cases, let's user pick their color scheme # The override value only will occur in user config files if [[ $B_RUNNING_IN_SHELL == 'true' ]];then - if [[ -z $DEFAULT_COLOR_SCHEME_OVERRIDE || $B_RUN_COLOR_SELECTOR == 'true' ]];then + # note, leaving this iff as a first run default for now, too many possible glitches could happen + # if [[ -z $DEFAULT_TERM_COLOR_SCHEME || $B_RUN_COLOR_SELECTOR == 'true' ]];then + if [[ $B_RUN_COLOR_SELECTOR == 'true' ]];then select_default_color_scheme - elif [[ -n $DEFAULT_COLOR_SCHEME_OVERRIDE ]];then - set_color_scheme $DEFAULT_COLOR_SCHEME_OVERRIDE + elif [[ -n $DEFAULT_TERM_COLOR_SCHEME ]];then + set_color_scheme $DEFAULT_TERM_COLOR_SCHEME + else + set_color_scheme "$DEFAULT_COLOR_SCHEME" fi else set_color_scheme "$DEFAULT_COLOR_SCHEME" @@ -818,7 +822,8 @@ select_default_color_scheme() print_screen_output "You will see this message only one time per user account, unless you set preferences in: /etc/$SCRIPT_NAME.conf" print_screen_output "" print_screen_output "Because there is no way to know your terminal client's foreground/background colors, we need" - print_screen_output "to set your color preferences from color scheme option list below. 0 is no colors." + print_screen_output "to set your color preferences from color scheme option list below. 0 is no colors, 1 neutral gray." + print_screen_output "After these, there are 3 sets: 1-dark or light backgrounds; 2-light backgrounds; 3-dark backgrounds." print_screen_output "Please note that this will set the preferences only for your user account: $(whoami)" print_screen_output "------------------------------------------------------------------------------" for (( i=0; i < ${#A_COLOR_SCHEMES[@]}; i++ )) @@ -834,23 +839,23 @@ select_default_color_scheme() print_screen_output " $(($i+1)))$spacer${C1} Exit, use another terminal, or set manually." print_screen_output "------------------------------------------------------------------------------" print_screen_output "Simply type the number for the color scheme that looks best to your eyes in the terminal client" - print_screen_output "you are using and hit enter. NOTE: You can bring this option list up by starting $SCRIPT_NAME with this option: " + print_screen_output "you are using and hit enter. NOTE: You can bring this option list up by starting $SCRIPT_NAME with this option: -c 99" print_screen_output "Your selection will be stored here: $HOME/.$SCRIPT_NAME/$SCRIPT_NAME.conf" print_screen_output "------------------------------------------------------------------------------" echo -n "" read user_selection if [[ -n $( grep -Es '^([0-9]+)$' <<< "$user_selection" ) && $user_selection -lt $i ]];then set_color_scheme $user_selection - if [[ ! -f $HOME/.$SCRIPT_NAME/$SCRIPT_NAME.conf || -z $( grep -s 'DEFAULT_COLOR_SCHEME_OVERRIDE=' $HOME/.$SCRIPT_NAME/$SCRIPT_NAME.conf ) ]];then + if [[ ! -f $HOME/.$SCRIPT_NAME/$SCRIPT_NAME.conf || -z $( grep -s 'DEFAULT_TERM_COLOR_SCHEME=' $HOME/.$SCRIPT_NAME/$SCRIPT_NAME.conf ) ]];then if [[ ! -d $HOME/.$SCRIPT_NAME ]];then mkdir $HOME/.$SCRIPT_NAME fi touch $HOME/.$SCRIPT_NAME/$SCRIPT_NAME.conf print_screen_output "Creating and updating config file now..." - echo "DEFAULT_COLOR_SCHEME_OVERRIDE=$user_selection" >> $HOME/.$SCRIPT_NAME/$SCRIPT_NAME.conf + echo "DEFAULT_TERM_COLOR_SCHEME=$user_selection" >> $HOME/.$SCRIPT_NAME/$SCRIPT_NAME.conf else print_screen_output "Updating config file now..." - sed -i "s/DEFAULT_COLOR_SCHEME_OVERRIDE=.*/DEFAULT_COLOR_SCHEME_OVERRIDE=$user_selection/" $HOME/.$SCRIPT_NAME/$SCRIPT_NAME.conf + sed -i "s/DEFAULT_TERM_COLOR_SCHEME=.*/DEFAULT_TERM_COLOR_SCHEME=$user_selection/" $HOME/.$SCRIPT_NAME/$SCRIPT_NAME.conf fi elif [[ $user_selection == $i ]];then set_color_scheme $DEFAULT_COLOR_SCHEME