Allow applet script to search path relative to the script for cli input themes

This commit is contained in:
Jacoby6000 2024-07-16 19:48:28 -05:00
parent 323f94069c
commit bd18d5972b
9 changed files with 117 additions and 72 deletions

View File

@ -6,17 +6,22 @@
## Applets : Run Applications as Root ## Applets : Run Applications as Root
# Import Current Theme # Import Current Theme
INPUT_THEME=$1 INPUT_THEME="$1"
SCRIPT_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
if [ -z $INPUT_THEME ]; then if [ -z "$INPUT_THEME" ]; then
source "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"/../shared/theme.bash source "$SCRIPT_DIR/../shared/theme.bash"
theme="$type/$style" theme="$type/$style"
elif [[ $1 == "-h" || $1 == "--help" ]]; then elif [[ $1 == "-h" || $1 == "--help" ]]; then
echo "Usage: $0 [theme]" echo "Usage: $0 [theme]"
exit 0 exit 0
else else
theme=$INPUT_THEME theme="$INPUT_THEME"
if [ ! -d $theme ]; then if [ ! -d $theme ];
# prepend current script path if theme is not found
theme="$SCRIPT_DIR/$theme"
if [ ! -d "$theme" ]; then
# fail if we still can't find it.
echo "Theme not found!" echo "Theme not found!"
exit 1 exit 1
fi fi

View File

@ -6,17 +6,22 @@
## Applets : Favorite Applications ## Applets : Favorite Applications
# Import Current Theme # Import Current Theme
INPUT_THEME=$1 INPUT_THEME="$1"
SCRIPT_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
if [ -z $INPUT_THEME ]; then if [ -z "$INPUT_THEME" ]; then
source "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"/../shared/theme.bash source "$SCRIPT_DIR/../shared/theme.bash"
theme="$type/$style" theme="$type/$style"
elif [[ $1 == "-h" || $1 == "--help" ]]; then elif [[ $1 == "-h" || $1 == "--help" ]]; then
echo "Usage: $0 [theme]" echo "Usage: $0 [theme]"
exit 0 exit 0
else else
theme=$INPUT_THEME theme="$INPUT_THEME"
if [ ! -d $theme ]; then if [ ! -d $theme ];
# prepend current script path if theme is not found
theme="$SCRIPT_DIR/$theme"
if [ ! -d "$theme" ]; then
# fail if we still can't find it.
echo "Theme not found!" echo "Theme not found!"
exit 1 exit 1
fi fi

View File

@ -6,17 +6,22 @@
## Applets : Battery ## Applets : Battery
# Import Current Theme # Import Current Theme
INPUT_THEME=$1 INPUT_THEME="$1"
SCRIPT_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
if [ -z $INPUT_THEME ]; then if [ -z "$INPUT_THEME" ]; then
source "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"/../shared/theme.bash source "$SCRIPT_DIR/../shared/theme.bash"
theme="$type/$style" theme="$type/$style"
elif [[ $1 == "-h" || $1 == "--help" ]]; then elif [[ $1 == "-h" || $1 == "--help" ]]; then
echo "Usage: $0 [theme]" echo "Usage: $0 [theme]"
exit 0 exit 0
else else
theme=$INPUT_THEME theme="$INPUT_THEME"
if [ ! -d $theme ]; then if [ ! -d $theme ];
# prepend current script path if theme is not found
theme="$SCRIPT_DIR/$theme"
if [ ! -d "$theme" ]; then
# fail if we still can't find it.
echo "Theme not found!" echo "Theme not found!"
exit 1 exit 1
fi fi

View File

@ -6,17 +6,22 @@
## Applets : Brightness ## Applets : Brightness
# Import Current Theme # Import Current Theme
INPUT_THEME=$1 INPUT_THEME="$1"
SCRIPT_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
if [ -z $INPUT_THEME ]; then if [ -z "$INPUT_THEME" ]; then
source "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"/../shared/theme.bash source "$SCRIPT_DIR/../shared/theme.bash"
theme="$type/$style" theme="$type/$style"
elif [[ $1 == "-h" || $1 == "--help" ]]; then elif [[ $1 == "-h" || $1 == "--help" ]]; then
echo "Usage: $0 [theme]" echo "Usage: $0 [theme]"
exit 0 exit 0
else else
theme=$INPUT_THEME theme="$INPUT_THEME"
if [ ! -d $theme ]; then if [ ! -d $theme ];
# prepend current script path if theme is not found
theme="$SCRIPT_DIR/$theme"
if [ ! -d "$theme" ]; then
# fail if we still can't find it.
echo "Theme not found!" echo "Theme not found!"
exit 1 exit 1
fi fi

View File

@ -6,17 +6,22 @@
## Applets : MPD (music) ## Applets : MPD (music)
# Import Current Theme # Import Current Theme
INPUT_THEME=$1 INPUT_THEME="$1"
SCRIPT_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
if [ -z $INPUT_THEME ]; then if [ -z "$INPUT_THEME" ]; then
source "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"/../shared/theme.bash source "$SCRIPT_DIR/../shared/theme.bash"
theme="$type/$style" theme="$type/$style"
elif [[ $1 == "-h" || $1 == "--help" ]]; then elif [[ $1 == "-h" || $1 == "--help" ]]; then
echo "Usage: $0 [theme]" echo "Usage: $0 [theme]"
exit 0 exit 0
else else
theme=$INPUT_THEME theme="$INPUT_THEME"
if [ ! -d $theme ]; then if [ ! -d $theme ];
# prepend current script path if theme is not found
theme="$SCRIPT_DIR/$theme"
if [ ! -d "$theme" ]; then
# fail if we still can't find it.
echo "Theme not found!" echo "Theme not found!"
exit 1 exit 1
fi fi

View File

@ -6,17 +6,22 @@
## Applets : Power Menu ## Applets : Power Menu
# Import Current Theme # Import Current Theme
INPUT_THEME=$1 INPUT_THEME="$1"
SCRIPT_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
if [ -z $INPUT_THEME ]; then if [ -z "$INPUT_THEME" ]; then
source "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"/../shared/theme.bash source "$SCRIPT_DIR/../shared/theme.bash"
theme="$type/$style" theme="$type/$style"
elif [[ $1 == "-h" || $1 == "--help" ]]; then elif [[ $1 == "-h" || $1 == "--help" ]]; then
echo "Usage: $0 [theme]" echo "Usage: $0 [theme]"
exit 0 exit 0
else else
theme=$INPUT_THEME theme="$INPUT_THEME"
if [ ! -d $theme ]; then if [ ! -d $theme ];
# prepend current script path if theme is not found
theme="$SCRIPT_DIR/$theme"
if [ ! -d "$theme" ]; then
# fail if we still can't find it.
echo "Theme not found!" echo "Theme not found!"
exit 1 exit 1
fi fi

View File

@ -6,17 +6,22 @@
## Applets : Quick Links ## Applets : Quick Links
# Import Current Theme # Import Current Theme
INPUT_THEME=$1 INPUT_THEME="$1"
SCRIPT_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
if [ -z $INPUT_THEME ]; then if [ -z "$INPUT_THEME" ]; then
source "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"/../shared/theme.bash source "$SCRIPT_DIR/../shared/theme.bash"
theme="$type/$style" theme="$type/$style"
elif [[ $1 == "-h" || $1 == "--help" ]]; then elif [[ $1 == "-h" || $1 == "--help" ]]; then
echo "Usage: $0 [theme]" echo "Usage: $0 [theme]"
exit 0 exit 0
else else
theme=$INPUT_THEME theme="$INPUT_THEME"
if [ ! -d $theme ]; then if [ ! -d $theme ];
# prepend current script path if theme is not found
theme="$SCRIPT_DIR/$theme"
if [ ! -d "$theme" ]; then
# fail if we still can't find it.
echo "Theme not found!" echo "Theme not found!"
exit 1 exit 1
fi fi

View File

@ -6,17 +6,22 @@
## Applets : Screenshot ## Applets : Screenshot
# Import Current Theme # Import Current Theme
INPUT_THEME=$1 INPUT_THEME="$1"
SCRIPT_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
if [ -z $INPUT_THEME ]; then if [ -z "$INPUT_THEME" ]; then
source "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"/../shared/theme.bash source "$SCRIPT_DIR/../shared/theme.bash"
theme="$type/$style" theme="$type/$style"
elif [[ $1 == "-h" || $1 == "--help" ]]; then elif [[ $1 == "-h" || $1 == "--help" ]]; then
echo "Usage: $0 [theme]" echo "Usage: $0 [theme]"
exit 0 exit 0
else else
theme=$INPUT_THEME theme="$INPUT_THEME"
if [ ! -d $theme ]; then if [ ! -d $theme ];
# prepend current script path if theme is not found
theme="$SCRIPT_DIR/$theme"
if [ ! -d "$theme" ]; then
# fail if we still can't find it.
echo "Theme not found!" echo "Theme not found!"
exit 1 exit 1
fi fi

View File

@ -6,17 +6,22 @@
## Applets : Volume ## Applets : Volume
# Import Current Theme # Import Current Theme
INPUT_THEME=$1 INPUT_THEME="$1"
SCRIPT_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
if [ -z $INPUT_THEME ]; then if [ -z "$INPUT_THEME" ]; then
source "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"/../shared/theme.bash source "$SCRIPT_DIR/../shared/theme.bash"
theme="$type/$style" theme="$type/$style"
elif [[ $1 == "-h" || $1 == "--help" ]]; then elif [[ $1 == "-h" || $1 == "--help" ]]; then
echo "Usage: $0 [theme]" echo "Usage: $0 [theme]"
exit 0 exit 0
else else
theme=$INPUT_THEME theme="$INPUT_THEME"
if [ ! -d $theme ]; then if [ ! -d $theme ];
# prepend current script path if theme is not found
theme="$SCRIPT_DIR/$theme"
if [ ! -d "$theme" ]; then
# fail if we still can't find it.
echo "Theme not found!" echo "Theme not found!"
exit 1 exit 1
fi fi