From 96c35229f06f5a099c7e1b072407a0848e11366b Mon Sep 17 00:00:00 2001 From: Dylan Date: Mon, 25 Jan 2016 10:36:42 +1100 Subject: [PATCH] Added options to enable/disable GTK2/3 output for GTK theme. --- README.md | 4 +++- fetch | 29 ++++++++++++++++++++++++++--- 2 files changed, 29 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 51ffce12..b6eb7ca3 100644 --- a/README.md +++ b/README.md @@ -179,8 +179,10 @@ alias fetch2="fetch \ scaling_current, scaling_min, scaling_max NOTE: This only support Linux with cpufreq. --uptime_shorthand Shorten the output of uptime - --gtk_shorthand on/off Shorten output of gtk theme/icons --gpu_shorthand on/off Shorten the output of GPU + --gtk_shorthand on/off Shorten output of gtk theme/icons + --gtk2 on/off Enable/Disable gtk2 theme/icons output + --gtk3 on/off Enable/Disable gtk3 theme/icons output Text Colors: --colors 1 2 3 4 5 Change the color of text diff --git a/fetch b/fetch index 3b9ca521..6c58f77c 100755 --- a/fetch +++ b/fetch @@ -112,6 +112,15 @@ uptime_shorthand="off" gtk_shorthand="off" +# Enable/Disable gtk2 theme/icons output +# --gtk2 on/off +gtk2="on" + +# Enable/Disable gtk3 theme/icons output +# --gtk3 on/off +gtk3="on" + + # Color Blocks # Color block range @@ -681,7 +690,7 @@ getcpu () { getgpu () { case "$os" in - "Linux" | "OpenBSD") + "Linux") gpu="$(lspci | grep "VGA")" gpu=${gpu/* VGA compatible controller: } gpu=${gpu/(rev*)} @@ -931,6 +940,16 @@ getgtk () { gtktheme="None" fi + # Hide gtk2 from gtk theme output + if [ "$gtk2" == "off" ]; then + gtktheme=${gtktheme/*'[GTK2], '} + fi + + # Hide gtk3 from gtk theme output + if [ "$gtk3" == "off" ]; then + gtktheme=${gtktheme/'[GTK2],'*/'[GTK2]'} + fi + # Make the output shorter by removing "[GTKX]" from the string if [ "$gtk_shorthand" == "on" ]; then gtktheme=${gtktheme/ '[GTK2]'} @@ -1256,8 +1275,10 @@ usage () { cat << EOF scaling_current, scaling_min, scaling_max NOTE: This only support Linux with cpufreq. --uptime_shorthand Shorten the output of uptime - --gtk_shorthand on/off Shorten output of gtk theme/icons --gpu_shorthand on/off Shorten the output of GPU + --gtk_shorthand on/off Shorten output of gtk theme/icons + --gtk2 on/off Enable/Disable gtk2 theme/icons output + --gtk3 on/off Enable/Disable gtk3 theme/icons output Text Colors: --colors 1 2 3 4 5 6 Change the color of text @@ -1334,8 +1355,10 @@ while [ "$1" ]; do # Info --speed_type) speed_type="$2" ;; --uptime_shorthand) uptime_shorthand="$2" ;; - --gtk_shorthand) gtk_shorthand="$2" ;; --gpu_shorthand) gpu_shorthand="$2" ;; + --gtk_shorthand) gtk_shorthand="$2" ;; + --gtk2) gtk2="$2" ;; + --gtk3) gtk3="$2" ;; # Text Colors --colors) title_color=$2