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
# Import Current Theme
INPUT_THEME=$1
if [ -z $INPUT_THEME ]; then
source "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"/../shared/theme.bash
INPUT_THEME="$1"
SCRIPT_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
if [ -z "$INPUT_THEME" ]; then
source "$SCRIPT_DIR/../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
theme="$INPUT_THEME"
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!"
exit 1
fi

View File

@ -6,17 +6,22 @@
## Applets : Favorite Applications
# Import Current Theme
INPUT_THEME=$1
if [ -z $INPUT_THEME ]; then
source "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"/../shared/theme.bash
INPUT_THEME="$1"
SCRIPT_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
if [ -z "$INPUT_THEME" ]; then
source "$SCRIPT_DIR/../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
theme="$INPUT_THEME"
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!"
exit 1
fi

View File

@ -6,17 +6,22 @@
## Applets : Battery
# Import Current Theme
INPUT_THEME=$1
if [ -z $INPUT_THEME ]; then
source "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"/../shared/theme.bash
INPUT_THEME="$1"
SCRIPT_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
if [ -z "$INPUT_THEME" ]; then
source "$SCRIPT_DIR/../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
theme="$INPUT_THEME"
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!"
exit 1
fi

View File

@ -6,17 +6,22 @@
## Applets : Brightness
# Import Current Theme
INPUT_THEME=$1
if [ -z $INPUT_THEME ]; then
source "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"/../shared/theme.bash
INPUT_THEME="$1"
SCRIPT_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
if [ -z "$INPUT_THEME" ]; then
source "$SCRIPT_DIR/../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
theme="$INPUT_THEME"
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!"
exit 1
fi

View File

@ -6,17 +6,22 @@
## Applets : MPD (music)
# Import Current Theme
INPUT_THEME=$1
if [ -z $INPUT_THEME ]; then
source "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"/../shared/theme.bash
INPUT_THEME="$1"
SCRIPT_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
if [ -z "$INPUT_THEME" ]; then
source "$SCRIPT_DIR/../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
theme="$INPUT_THEME"
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!"
exit 1
fi

View File

@ -6,17 +6,22 @@
## Applets : Power Menu
# Import Current Theme
INPUT_THEME=$1
if [ -z $INPUT_THEME ]; then
source "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"/../shared/theme.bash
INPUT_THEME="$1"
SCRIPT_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
if [ -z "$INPUT_THEME" ]; then
source "$SCRIPT_DIR/../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
theme="$INPUT_THEME"
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!"
exit 1
fi

View File

@ -6,17 +6,22 @@
## Applets : Quick Links
# Import Current Theme
INPUT_THEME=$1
if [ -z $INPUT_THEME ]; then
source "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"/../shared/theme.bash
INPUT_THEME="$1"
SCRIPT_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
if [ -z "$INPUT_THEME" ]; then
source "$SCRIPT_DIR/../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
theme="$INPUT_THEME"
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!"
exit 1
fi

View File

@ -6,17 +6,22 @@
## Applets : Screenshot
# Import Current Theme
INPUT_THEME=$1
if [ -z $INPUT_THEME ]; then
source "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"/../shared/theme.bash
INPUT_THEME="$1"
SCRIPT_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
if [ -z "$INPUT_THEME" ]; then
source "$SCRIPT_DIR/../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
theme="$INPUT_THEME"
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!"
exit 1
fi

View File

@ -6,17 +6,22 @@
## Applets : Volume
# Import Current Theme
INPUT_THEME=$1
if [ -z $INPUT_THEME ]; then
source "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"/../shared/theme.bash
INPUT_THEME="$1"
SCRIPT_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
if [ -z "$INPUT_THEME" ]; then
source "$SCRIPT_DIR/../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
theme="$INPUT_THEME"
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!"
exit 1
fi