Added option to enable/disable config files and cleaned up comments in config

This commit is contained in:
Dylan 2016-01-30 11:30:21 +11:00
parent 91034c3d7e
commit c072c9a240
3 changed files with 11 additions and 59 deletions

3
1.1.md
View File

@ -2,7 +2,8 @@
- Fetch now has a config file that you can share with people and<br \> - Fetch now has a config file that you can share with people and<br \>
keep between script versions! 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. - If `w3m` or `imagemagick` aren't installed we gracefully fallback to no image mode.
- Fix padding escape codes on BSD systems. - Fix padding escape codes on BSD systems.
- Swap escape codes from `\e` to `\033` for consistency. - Swap escape codes from `\e` to `\033` for consistency.

35
config
View File

@ -9,38 +9,9 @@ export LC_ALL=C
export LANG=c export LANG=c
export LANGUAGE=C export LANGUAGE=C
# Config Options {{{
# Info Options {{{ # Info Options {{{
# Info # 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: # See this wiki page for more info:
# https://github.com/dylanaraps/fetch/wiki/Customizing-Info # https://github.com/dylanaraps/fetch/wiki/Customizing-Info
printinfo () { printinfo () {
@ -317,12 +288,12 @@ scrot_name="fetch-%Y-%m-%d-%H:%M.png"
# Config Options {{{ # Config Options {{{
# Enable/Disable config file
config="on"
# Path to custom config file location # Path to custom config file location
# --config path/to/config # --config path/to/config
config_file="$HOME/.config/fetch/config" config_file="$HOME/.config/fetch/config"
# }}}
# }}} # }}}

32
fetch
View File

@ -33,31 +33,6 @@ export LANGUAGE=C
# Info # 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: # See this wiki page for more info:
# https://github.com/dylanaraps/fetch/wiki/Customizing-Info # https://github.com/dylanaraps/fetch/wiki/Customizing-Info
printinfo () { printinfo () {
@ -334,6 +309,9 @@ scrot_name="fetch-%Y-%m-%d-%H:%M.png"
# Config Options {{{ # Config Options {{{
# Enable/Disable config file
config="on"
# Path to custom config file location # Path to custom config file location
# --config path/to/config # --config path/to/config
config_file="$HOME/.config/fetch/config" config_file="$HOME/.config/fetch/config"
@ -1789,7 +1767,9 @@ getconfig () {
source "$HOME/.config/fetch/config" source "$HOME/.config/fetch/config"
fi fi
} }
getconfig
# If config files are enabled
[ "$config" == "on" ] && getconfig
# }}} # }}}