From 323f94069c8977c5d9bc9cad5a74b10321c1c31e Mon Sep 17 00:00:00 2001 From: Jacoby6000 Date: Tue, 16 Jul 2024 19:36:40 -0500 Subject: [PATCH] Enable theme specification via cli --- files/applets/bin/appasroot.sh | 17 +++++++++++++++-- files/applets/bin/apps.sh | 18 ++++++++++++++++-- files/applets/bin/battery.sh | 18 ++++++++++++++++-- files/applets/bin/brightness.sh | 17 +++++++++++++++-- files/applets/bin/mpd.sh | 18 ++++++++++++++++-- files/applets/bin/powermenu.sh | 18 ++++++++++++++++-- files/applets/bin/quicklinks.sh | 17 +++++++++++++++-- files/applets/bin/screenshot.sh | 18 ++++++++++++++++-- files/applets/bin/volume.sh | 18 ++++++++++++++++-- files/launchers/type-1/launcher.sh | 16 +++++++++++++++- files/launchers/type-2/launcher.sh | 15 ++++++++++++++- files/launchers/type-3/launcher.sh | 15 ++++++++++++++- files/launchers/type-4/launcher.sh | 16 ++++++++++++++-- files/launchers/type-5/launcher.sh | 16 ++++++++++++++-- files/launchers/type-6/launcher.sh | 16 ++++++++++++++-- files/launchers/type-7/launcher.sh | 16 ++++++++++++++-- files/powermenu/type-1/powermenu.sh | 15 ++++++++++++++- files/powermenu/type-2/powermenu.sh | 15 ++++++++++++++- files/powermenu/type-3/powermenu.sh | 15 ++++++++++++++- files/powermenu/type-4/powermenu.sh | 15 ++++++++++++++- files/powermenu/type-5/powermenu.sh | 15 ++++++++++++++- files/powermenu/type-6/powermenu.sh | 15 ++++++++++++++- 22 files changed, 324 insertions(+), 35 deletions(-) diff --git a/files/applets/bin/appasroot.sh b/files/applets/bin/appasroot.sh index 41bd193..64d6486 100755 --- a/files/applets/bin/appasroot.sh +++ b/files/applets/bin/appasroot.sh @@ -6,8 +6,21 @@ ## Applets : Run Applications as Root # Import Current Theme -source "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"/../shared/theme.bash -theme="$type/$style" +INPUT_THEME=$1 + +if [ -z $INPUT_THEME ]; then + source "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"/../shared/theme.bash + theme="$type/$style" +elif [[ $1 == "-h" || $1 == "--help" ]]; then + echo "Usage: $0 [theme]" + exit 0 +else + theme=$INPUT_THEME + if [ ! -d $theme ]; then + echo "Theme not found!" + exit 1 + fi +fi # Theme Elements prompt='Applications' diff --git a/files/applets/bin/apps.sh b/files/applets/bin/apps.sh index efb3e92..25d34bc 100755 --- a/files/applets/bin/apps.sh +++ b/files/applets/bin/apps.sh @@ -6,8 +6,22 @@ ## Applets : Favorite Applications # Import Current Theme -source "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"/../shared/theme.bash -theme="$type/$style" +INPUT_THEME=$1 + +if [ -z $INPUT_THEME ]; then + source "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"/../shared/theme.bash + theme="$type/$style" +elif [[ $1 == "-h" || $1 == "--help" ]]; then + echo "Usage: $0 [theme]" + exit 0 +else + theme=$INPUT_THEME + if [ ! -d $theme ]; then + echo "Theme not found!" + exit 1 + fi +fi + # Theme Elements prompt='Applications' diff --git a/files/applets/bin/battery.sh b/files/applets/bin/battery.sh index 50555db..f5deba5 100755 --- a/files/applets/bin/battery.sh +++ b/files/applets/bin/battery.sh @@ -6,8 +6,22 @@ ## Applets : Battery # Import Current Theme -source "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"/../shared/theme.bash -theme="$type/$style" +INPUT_THEME=$1 + +if [ -z $INPUT_THEME ]; then + source "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"/../shared/theme.bash + theme="$type/$style" +elif [[ $1 == "-h" || $1 == "--help" ]]; then + echo "Usage: $0 [theme]" + exit 0 +else + theme=$INPUT_THEME + if [ ! -d $theme ]; then + echo "Theme not found!" + exit 1 + fi +fi + # Battery Info battery="`acpi -b | cut -d',' -f1 | cut -d':' -f1`" diff --git a/files/applets/bin/brightness.sh b/files/applets/bin/brightness.sh index b5bc571..62035aa 100755 --- a/files/applets/bin/brightness.sh +++ b/files/applets/bin/brightness.sh @@ -6,8 +6,21 @@ ## Applets : Brightness # Import Current Theme -source "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"/../shared/theme.bash -theme="$type/$style" +INPUT_THEME=$1 + +if [ -z $INPUT_THEME ]; then + source "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"/../shared/theme.bash + theme="$type/$style" +elif [[ $1 == "-h" || $1 == "--help" ]]; then + echo "Usage: $0 [theme]" + exit 0 +else + theme=$INPUT_THEME + if [ ! -d $theme ]; then + echo "Theme not found!" + exit 1 + fi +fi # Brightness Info backlight="$(printf "%.0f\n" `light -G`)" diff --git a/files/applets/bin/mpd.sh b/files/applets/bin/mpd.sh index f53da26..c7ffd8a 100755 --- a/files/applets/bin/mpd.sh +++ b/files/applets/bin/mpd.sh @@ -6,8 +6,22 @@ ## Applets : MPD (music) # Import Current Theme -source "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"/../shared/theme.bash -theme="$type/$style" +INPUT_THEME=$1 + +if [ -z $INPUT_THEME ]; then + source "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"/../shared/theme.bash + theme="$type/$style" +elif [[ $1 == "-h" || $1 == "--help" ]]; then + echo "Usage: $0 [theme]" + exit 0 +else + theme=$INPUT_THEME + if [ ! -d $theme ]; then + echo "Theme not found!" + exit 1 + fi +fi + # Theme Elements status="`mpc status`" diff --git a/files/applets/bin/powermenu.sh b/files/applets/bin/powermenu.sh index ce11289..56727a5 100755 --- a/files/applets/bin/powermenu.sh +++ b/files/applets/bin/powermenu.sh @@ -6,8 +6,22 @@ ## Applets : Power Menu # Import Current Theme -source "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"/../shared/theme.bash -theme="$type/$style" +INPUT_THEME=$1 + +if [ -z $INPUT_THEME ]; then + source "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"/../shared/theme.bash + theme="$type/$style" +elif [[ $1 == "-h" || $1 == "--help" ]]; then + echo "Usage: $0 [theme]" + exit 0 +else + theme=$INPUT_THEME + if [ ! -d $theme ]; then + echo "Theme not found!" + exit 1 + fi +fi + # Theme Elements prompt="`hostname`" diff --git a/files/applets/bin/quicklinks.sh b/files/applets/bin/quicklinks.sh index 0cf4881..a8a20c6 100755 --- a/files/applets/bin/quicklinks.sh +++ b/files/applets/bin/quicklinks.sh @@ -6,8 +6,21 @@ ## Applets : Quick Links # Import Current Theme -source "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"/../shared/theme.bash -theme="$type/$style" +INPUT_THEME=$1 + +if [ -z $INPUT_THEME ]; then + source "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"/../shared/theme.bash + theme="$type/$style" +elif [[ $1 == "-h" || $1 == "--help" ]]; then + echo "Usage: $0 [theme]" + exit 0 +else + theme=$INPUT_THEME + if [ ! -d $theme ]; then + echo "Theme not found!" + exit 1 + fi +fi # Theme Elements prompt='Quick Links' diff --git a/files/applets/bin/screenshot.sh b/files/applets/bin/screenshot.sh index d7a6879..7380ade 100755 --- a/files/applets/bin/screenshot.sh +++ b/files/applets/bin/screenshot.sh @@ -6,8 +6,22 @@ ## Applets : Screenshot # Import Current Theme -source "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"/../shared/theme.bash -theme="$type/$style" +INPUT_THEME=$1 + +if [ -z $INPUT_THEME ]; then + source "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"/../shared/theme.bash + theme="$type/$style" +elif [[ $1 == "-h" || $1 == "--help" ]]; then + echo "Usage: $0 [theme]" + exit 0 +else + theme=$INPUT_THEME + if [ ! -d $theme ]; then + echo "Theme not found!" + exit 1 + fi +fi + # Theme Elements prompt='Screenshot' diff --git a/files/applets/bin/volume.sh b/files/applets/bin/volume.sh index 1110aa8..d6bf62e 100755 --- a/files/applets/bin/volume.sh +++ b/files/applets/bin/volume.sh @@ -6,8 +6,22 @@ ## Applets : Volume # Import Current Theme -source "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"/../shared/theme.bash -theme="$type/$style" +INPUT_THEME=$1 + +if [ -z $INPUT_THEME ]; then + source "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"/../shared/theme.bash + theme="$type/$style" +elif [[ $1 == "-h" || $1 == "--help" ]]; then + echo "Usage: $0 [theme]" + exit 0 +else + theme=$INPUT_THEME + if [ ! -d $theme ]; then + echo "Theme not found!" + exit 1 + fi +fi + # Volume Info mixer="`amixer info Master | grep 'Mixer name' | cut -d':' -f2 | tr -d \',' '`" diff --git a/files/launchers/type-1/launcher.sh b/files/launchers/type-1/launcher.sh index e39e904..6e532c4 100755 --- a/files/launchers/type-1/launcher.sh +++ b/files/launchers/type-1/launcher.sh @@ -11,8 +11,22 @@ ## style-6 style-7 style-8 style-9 style-10 ## style-11 style-12 style-13 style-14 style-15 +INPUT_THEME=$1 dir="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" -theme='style-1' +if [ -z $INPUT_THEME ]; then + theme='style-1' +elif [[ $1 == "-h" || $1 == "--help" ]]; then + echo "Usage: $0 [style-1..15]" + exit 0 +else + theme=$INPUT_THEME + if [ ! -d ${dir}/$theme.rasi ]; then + echo "Theme not found!" + exit 1 + fi +fi + + ## Run rofi \ diff --git a/files/launchers/type-2/launcher.sh b/files/launchers/type-2/launcher.sh index e39e904..1917b31 100755 --- a/files/launchers/type-2/launcher.sh +++ b/files/launchers/type-2/launcher.sh @@ -11,8 +11,21 @@ ## style-6 style-7 style-8 style-9 style-10 ## style-11 style-12 style-13 style-14 style-15 +INPUT_THEME=$1 dir="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" -theme='style-1' +if [ -z $INPUT_THEME ]; then + theme='style-1' +elif [[ $1 == "-h" || $1 == "--help" ]]; then + echo "Usage: $0 [style-1..15]" + exit 0 +else + theme=$INPUT_THEME + if [ ! -d ${dir}/$theme.rasi ]; then + echo "Theme not found!" + exit 1 + fi +fi + ## Run rofi \ diff --git a/files/launchers/type-3/launcher.sh b/files/launchers/type-3/launcher.sh index 1d6e6ec..e694879 100755 --- a/files/launchers/type-3/launcher.sh +++ b/files/launchers/type-3/launcher.sh @@ -10,8 +10,21 @@ ## style-1 style-2 style-3 style-4 style-5 ## style-6 style-7 style-8 style-9 style-10 +INPUT_THEME=$1 dir="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" -theme='style-10' +if [ -z $INPUT_THEME ]; then + theme='style-10' +elif [[ $1 == "-h" || $1 == "--help" ]]; then + echo "Usage: $0 [style-1..10]" + exit 0 +else + theme=$INPUT_THEME + if [ ! -d ${dir}/$theme.rasi ]; then + echo "Theme not found!" + exit 1 + fi +fi + ## Run rofi \ diff --git a/files/launchers/type-4/launcher.sh b/files/launchers/type-4/launcher.sh index fba55bc..9f950ea 100755 --- a/files/launchers/type-4/launcher.sh +++ b/files/launchers/type-4/launcher.sh @@ -9,9 +9,21 @@ # ## style-1 style-2 style-3 style-4 style-5 ## style-6 style-7 style-8 style-9 style-10 - +INPUT_THEME=$1 dir="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" -theme='style-1' +if [ -z $INPUT_THEME ]; then + theme='style-1' +elif [[ $1 == "-h" || $1 == "--help" ]]; then + echo "Usage: $0 [style-1..10]" + exit 0 +else + theme=$INPUT_THEME + if [ ! -d ${dir}/$theme.rasi ]; then + echo "Theme not found!" + exit 1 + fi +fi + ## Run rofi \ diff --git a/files/launchers/type-5/launcher.sh b/files/launchers/type-5/launcher.sh index a1cfb8c..6b5e812 100755 --- a/files/launchers/type-5/launcher.sh +++ b/files/launchers/type-5/launcher.sh @@ -8,9 +8,21 @@ ## Available Styles # ## style-1 style-2 style-3 style-4 style-5 - +INPUT_THEME=$1 dir="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" -theme='style-1' +if [ -z $INPUT_THEME ]; then + theme='style-1' +elif [[ $1 == "-h" || $1 == "--help" ]]; then + echo "Usage: $0 [style-1..5]" + exit 0 +else + theme=$INPUT_THEME + if [ ! -d ${dir}/$theme.rasi ]; then + echo "Theme not found!" + exit 1 + fi +fi + ## Run rofi \ diff --git a/files/launchers/type-6/launcher.sh b/files/launchers/type-6/launcher.sh index fba55bc..9f950ea 100755 --- a/files/launchers/type-6/launcher.sh +++ b/files/launchers/type-6/launcher.sh @@ -9,9 +9,21 @@ # ## style-1 style-2 style-3 style-4 style-5 ## style-6 style-7 style-8 style-9 style-10 - +INPUT_THEME=$1 dir="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" -theme='style-1' +if [ -z $INPUT_THEME ]; then + theme='style-1' +elif [[ $1 == "-h" || $1 == "--help" ]]; then + echo "Usage: $0 [style-1..10]" + exit 0 +else + theme=$INPUT_THEME + if [ ! -d ${dir}/$theme.rasi ]; then + echo "Theme not found!" + exit 1 + fi +fi + ## Run rofi \ diff --git a/files/launchers/type-7/launcher.sh b/files/launchers/type-7/launcher.sh index fba55bc..9f950ea 100755 --- a/files/launchers/type-7/launcher.sh +++ b/files/launchers/type-7/launcher.sh @@ -9,9 +9,21 @@ # ## style-1 style-2 style-3 style-4 style-5 ## style-6 style-7 style-8 style-9 style-10 - +INPUT_THEME=$1 dir="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" -theme='style-1' +if [ -z $INPUT_THEME ]; then + theme='style-1' +elif [[ $1 == "-h" || $1 == "--help" ]]; then + echo "Usage: $0 [style-1..10]" + exit 0 +else + theme=$INPUT_THEME + if [ ! -d ${dir}/$theme.rasi ]; then + echo "Theme not found!" + exit 1 + fi +fi + ## Run rofi \ diff --git a/files/powermenu/type-1/powermenu.sh b/files/powermenu/type-1/powermenu.sh index facf578..73a6946 100755 --- a/files/powermenu/type-1/powermenu.sh +++ b/files/powermenu/type-1/powermenu.sh @@ -10,8 +10,21 @@ ## style-1 style-2 style-3 style-4 style-5 # Current Theme +INPUT_THEME=$1 dir="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" -theme='style-1' +if [ -z $INPUT_THEME ]; then + theme='style-1' +elif [[ $1 == "-h" || $1 == "--help" ]]; then + echo "Usage: $0 [style-1..5]" + exit 0 +else + theme=$INPUT_THEME + if [ ! -d ${dir}/$theme.rasi ]; then + echo "Theme not found!" + exit 1 + fi +fi + # CMDs uptime="`uptime -p | sed -e 's/up //g'`" diff --git a/files/powermenu/type-2/powermenu.sh b/files/powermenu/type-2/powermenu.sh index 0b60b25..c984006 100755 --- a/files/powermenu/type-2/powermenu.sh +++ b/files/powermenu/type-2/powermenu.sh @@ -11,8 +11,21 @@ ## style-6 style-7 style-8 style-9 style-10 # Current Theme +INPUT_THEME=$1 dir="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" -theme='style-1' +if [ -z $INPUT_THEME ]; then + theme='style-1' +elif [[ $1 == "-h" || $1 == "--help" ]]; then + echo "Usage: $0 [style-1..10]" + exit 0 +else + theme=$INPUT_THEME + if [ ! -d ${dir}/$theme.rasi ]; then + echo "Theme not found!" + exit 1 + fi +fi + # CMDs uptime="`uptime -p | sed -e 's/up //g'`" diff --git a/files/powermenu/type-3/powermenu.sh b/files/powermenu/type-3/powermenu.sh index ab4f91c..a6a7ac3 100755 --- a/files/powermenu/type-3/powermenu.sh +++ b/files/powermenu/type-3/powermenu.sh @@ -10,8 +10,21 @@ ## style-1 style-2 style-3 style-4 style-5 # Current Theme +INPUT_THEME=$1 dir="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" -theme='style-1' +if [ -z $INPUT_THEME ]; then + theme='style-1' +elif [[ $1 == "-h" || $1 == "--help" ]]; then + echo "Usage: $0 [style-1..10]" + exit 0 +else + theme=$INPUT_THEME + if [ ! -d ${dir}/$theme.rasi ]; then + echo "Theme not found!" + exit 1 + fi +fi + # CMDs uptime="`uptime -p | sed -e 's/up //g'`" diff --git a/files/powermenu/type-4/powermenu.sh b/files/powermenu/type-4/powermenu.sh index 18a815f..6cd8ee5 100755 --- a/files/powermenu/type-4/powermenu.sh +++ b/files/powermenu/type-4/powermenu.sh @@ -10,8 +10,21 @@ ## style-1 style-2 style-3 style-4 style-5 # Current Theme +INPUT_THEME=$1 dir="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" -theme='style-5' +if [ -z $INPUT_THEME ]; then + theme='style-5' +elif [[ $1 == "-h" || $1 == "--help" ]]; then + echo "Usage: $0 [style-1..5]" + exit 0 +else + theme=$INPUT_THEME + if [ ! -d ${dir}/$theme.rasi ]; then + echo "Theme not found!" + exit 1 + fi +fi + # CMDs uptime="`uptime -p | sed -e 's/up //g'`" diff --git a/files/powermenu/type-5/powermenu.sh b/files/powermenu/type-5/powermenu.sh index 66443aa..ee855ac 100755 --- a/files/powermenu/type-5/powermenu.sh +++ b/files/powermenu/type-5/powermenu.sh @@ -10,8 +10,21 @@ ## style-1 style-2 style-3 style-4 style-5 # Current Theme +INPUT_THEME=$1 dir="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" -theme='style-1' +if [ -z $INPUT_THEME ]; then + theme='style-1' +elif [[ $1 == "-h" || $1 == "--help" ]]; then + echo "Usage: $0 [style-1..5]" + exit 0 +else + theme=$INPUT_THEME + if [ ! -d ${dir}/$theme.rasi ]; then + echo "Theme not found!" + exit 1 + fi +fi + # CMDs lastlogin="`last $USER | head -n1 | tr -s ' ' | cut -d' ' -f5,6,7`" diff --git a/files/powermenu/type-6/powermenu.sh b/files/powermenu/type-6/powermenu.sh index afa8e7f..3af3744 100755 --- a/files/powermenu/type-6/powermenu.sh +++ b/files/powermenu/type-6/powermenu.sh @@ -10,8 +10,21 @@ ## style-1 style-2 style-3 style-4 style-5 # Current Theme +INPUT_THEME=$1 dir="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" -theme='style-1' +if [ -z $INPUT_THEME ]; then + theme='style-1' +elif [[ $1 == "-h" || $1 == "--help" ]]; then + echo "Usage: $0 [style-1..5]" + exit 0 +else + theme=$INPUT_THEME + if [ ! -d ${dir}/$theme.rasi ]; then + echo "Theme not found!" + exit 1 + fi +fi + # CMDs lastlogin="`last $USER | head -n1 | tr -s ' ' | cut -d' ' -f5,6,7`"