From c072c9a240efc1addc05a9f53918579e1ff5461d Mon Sep 17 00:00:00 2001 From: Dylan Date: Sat, 30 Jan 2016 11:30:21 +1100 Subject: [PATCH] Added option to enable/disable config files and cleaned up comments in config --- 1.1.md | 3 ++- config | 35 +++-------------------------------- fetch | 32 ++++++-------------------------- 3 files changed, 11 insertions(+), 59 deletions(-) diff --git a/1.1.md b/1.1.md index 8ea20343..09325cda 100644 --- a/1.1.md +++ b/1.1.md @@ -2,7 +2,8 @@ - Fetch now has a config file that you can share with people and
keep between script versions! -- Added `--config` and `$config` to specify a custom config location. +- Added `--config` and `$config_file` to specify a custom config location. +- Added `$config` to enable / disable config files - If `w3m` or `imagemagick` aren't installed we gracefully fallback to no image mode. - Fix padding escape codes on BSD systems. - Swap escape codes from `\e` to `\033` for consistency. diff --git a/config b/config index ab0496d8..e5049f53 100644 --- a/config +++ b/config @@ -9,38 +9,9 @@ export LC_ALL=C export LANG=c export LANGUAGE=C -# Config Options {{{ - - # Info Options {{{ - # Info -# What to display and in what order. -# You can use ANY bash syntax in the function below! -# For example you could use if statments to only print info -# when a condition is true! -# -# The script comes with two helper functions: -# info: -# info "subtitle" funcname -# prin: -# prin "Custom message to print" -# prin "Subtitle: Custom message to print" -# prin "Subtitle: $(date)" -# -# You can also just use printf / echo to add lines but you'll -# need to prefix your msg with "${padding}", for example: -# echo -e "${padding} My custom message here" -# -# Info functions enabled by default are: -# "title" "distro" "kernel" "uptime" "packages" -# "shell" "resolution" "windowmanager" "gtktheme" -# "gtkicons" "cpu" "gpu" "memory" "cols" -# -# Info functions that are disabled by default are: -# "resolution" "song" "visualstyle" "font" "disk" -# # See this wiki page for more info: # https://github.com/dylanaraps/fetch/wiki/Customizing-Info printinfo () { @@ -317,12 +288,12 @@ scrot_name="fetch-%Y-%m-%d-%H:%M.png" # Config Options {{{ +# Enable/Disable config file +config="on" + # Path to custom config file location # --config path/to/config config_file="$HOME/.config/fetch/config" -# }}} - - # }}} diff --git a/fetch b/fetch index 30f39196..60db492e 100755 --- a/fetch +++ b/fetch @@ -33,31 +33,6 @@ export LANGUAGE=C # Info -# What to display and in what order. -# You can use ANY bash syntax in the function below! -# For example you could use if statments to only print info -# when a condition is true! -# -# The script comes with two helper functions: -# info: -# info "subtitle" funcname -# prin: -# prin "Custom message to print" -# prin "Subtitle: Custom message to print" -# prin "Subtitle: $(date)" -# -# You can also just use printf / echo to add lines but you'll -# need to prefix your msg with "${padding}", for example: -# echo -e "${padding} My custom message here" -# -# Info functions enabled by default are: -# "title" "distro" "kernel" "uptime" "packages" -# "shell" "resolution" "windowmanager" "gtktheme" -# "gtkicons" "cpu" "gpu" "memory" "cols" -# -# Info functions that are disabled by default are: -# "resolution" "song" "visualstyle" "font" "disk" -# # See this wiki page for more info: # https://github.com/dylanaraps/fetch/wiki/Customizing-Info printinfo () { @@ -334,6 +309,9 @@ scrot_name="fetch-%Y-%m-%d-%H:%M.png" # Config Options {{{ +# Enable/Disable config file +config="on" + # Path to custom config file location # --config path/to/config config_file="$HOME/.config/fetch/config" @@ -1789,7 +1767,9 @@ getconfig () { source "$HOME/.config/fetch/config" fi } -getconfig + +# If config files are enabled +[ "$config" == "on" ] && getconfig # }}}