Commit 2cc7e362 authored by Dylan Araps's avatar Dylan Araps Committed by GitHub

Merge pull request #514 from dylanaraps/optim

General: Optimize usage of get_de(), get_wm() and get_term().
parents e67ea664 c08ba009
......@@ -555,6 +555,9 @@ get_de() {
*"xfce4"*) de="XFCE4" ;;
*"xfce5"*) de="XFCE5" ;;
esac
# Log that the function was run.
de_run=1
}
get_wm() {
......@@ -579,11 +582,14 @@ get_wm() {
;;
esac
fi
# Log that the function was run.
wm_run=1
}
get_wm_theme() {
[[ -z "$wm" ]] && get_wm
[[ -z "$de" ]] && get_de
(( "$wm_run" != 1 )) && get_wm
(( "$de_run" != 1 )) && get_de
case "$wm" in
"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
# Get DE if user has disabled the function.
[[ -z "$de" ]] && get_de
(( "$de_run" != 1 )) && get_de
# Check for DE Theme.
case "$de" in
......@@ -1531,10 +1537,13 @@ get_term() {
"gnome-terminal-") term="gnome-terminal" ;;
*) term="${name##*/}" ;;
esac
# Log that the function was run.
term_run=1
}
get_term_font() {
[[ -z "$term" ]] && get_term
(( "$term_run" != 1 )) && get_term
case "$term" in
"urxvt" | "urxvtd" | "xterm")
......@@ -2033,7 +2042,7 @@ get_wallpaper() {
case "$os" in
"Linux" | "BSD" | "Solaris" | "GNU")
# Get DE if user has disabled the function.
[[ -z "$de" ]] && get_de
(( "$de_run" != 1 )) && get_de
case "$de" in
"Cinnamon"*) image="$(gsettings get org.cinnamon.desktop.background picture-uri)" ;;
......@@ -2925,7 +2934,7 @@ get_term_padding() {
#
# Note: This issue only seems to affect
# URxvt.
[[ -z "$term" ]] && get_term
(( "$term_run" != 1 )) && get_term
case "$term" in
"URxvt"*)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment