General: Instead of running functions multiple time, log it

This commit is contained in:
Dylan Araps 2016-12-09 15:20:40 +11:00
parent 05920781e4
commit c08ba009d7
1 changed files with 15 additions and 6 deletions

View File

@ -555,6 +555,9 @@ get_de() {
*"xfce4"*) de="XFCE4" ;; *"xfce4"*) de="XFCE4" ;;
*"xfce5"*) de="XFCE5" ;; *"xfce5"*) de="XFCE5" ;;
esac esac
# Log that the function was run.
de_run=1
} }
get_wm() { get_wm() {
@ -579,11 +582,14 @@ get_wm() {
;; ;;
esac esac
fi fi
# Log that the function was run.
wm_run=1
} }
get_wm_theme() { get_wm_theme() {
[[ -z "$wm" ]] && get_wm (( "$wm_run" != 1 )) && get_wm
[[ -z "$de" ]] && get_de (( "$de_run" != 1 )) && get_de
case "$wm" in case "$wm" in
"E16") wm_theme="$(awk -F "= " '/theme.name/ {print $2}' "$HOME/.e16/e_config--0.0.cfg")";; "E16") wm_theme="$(awk -F "= " '/theme.name/ {print $2}' "$HOME/.e16/e_config--0.0.cfg")";;
@ -1336,7 +1342,7 @@ get_style() {
if [[ -n "$DISPLAY" && "$os" != "Mac OS X" ]]; then if [[ -n "$DISPLAY" && "$os" != "Mac OS X" ]]; then
# Get DE if user has disabled the function. # Get DE if user has disabled the function.
[[ -z "$de" ]] && get_de (( "$de_run" != 1 )) && get_de
# Check for DE Theme. # Check for DE Theme.
case "$de" in case "$de" in
@ -1531,10 +1537,13 @@ get_term() {
"gnome-terminal-") term="gnome-terminal" ;; "gnome-terminal-") term="gnome-terminal" ;;
*) term="${name##*/}" ;; *) term="${name##*/}" ;;
esac esac
# Log that the function was run.
term_run=1
} }
get_term_font() { get_term_font() {
[[ -z "$term" ]] && get_term (( "$term_run" != 1 )) && get_term
case "$term" in case "$term" in
"urxvt" | "urxvtd" | "xterm") "urxvt" | "urxvtd" | "xterm")
@ -2033,7 +2042,7 @@ get_wallpaper() {
case "$os" in case "$os" in
"Linux" | "BSD" | "Solaris" | "GNU") "Linux" | "BSD" | "Solaris" | "GNU")
# Get DE if user has disabled the function. # Get DE if user has disabled the function.
[[ -z "$de" ]] && get_de (( "$de_run" != 1 )) && get_de
case "$de" in case "$de" in
"Cinnamon"*) image="$(gsettings get org.cinnamon.desktop.background picture-uri)" ;; "Cinnamon"*) image="$(gsettings get org.cinnamon.desktop.background picture-uri)" ;;
@ -2925,7 +2934,7 @@ get_term_padding() {
# #
# Note: This issue only seems to affect # Note: This issue only seems to affect
# URxvt. # URxvt.
[[ -z "$term" ]] && get_term (( "$term_run" != 1 )) && get_term
case "$term" in case "$term" in
"URxvt"*) "URxvt"*)