From 9060e5c6e13c7af5c74d5db959673ea46ddee921 Mon Sep 17 00:00:00 2001 From: Jacoby6000 Date: Tue, 16 Jul 2024 18:28:49 -0500 Subject: [PATCH 1/7] Use relative paths and readlink for portability --- files/applets/bin/appasroot.sh | 2 +- files/applets/bin/apps.sh | 2 +- files/applets/bin/battery.sh | 2 +- files/applets/bin/brightness.sh | 2 +- files/applets/bin/mpd.sh | 2 +- files/applets/bin/powermenu.sh | 2 +- files/applets/bin/quicklinks.sh | 2 +- files/applets/bin/screenshot.sh | 2 +- files/applets/bin/volume.sh | 2 +- files/applets/shared/colors.rasi | 2 +- files/applets/shared/theme.bash | 2 +- files/launchers/type-1/launcher.sh | 2 +- files/launchers/type-1/shared/colors.rasi | 2 +- files/launchers/type-2/launcher.sh | 2 +- files/launchers/type-2/shared/colors.rasi | 2 +- files/launchers/type-3/launcher.sh | 2 +- files/launchers/type-3/shared/colors.rasi | 2 +- files/launchers/type-4/launcher.sh | 2 +- files/launchers/type-4/shared/colors.rasi | 2 +- files/launchers/type-5/launcher.sh | 2 +- files/launchers/type-6/launcher.sh | 2 +- files/launchers/type-7/launcher.sh | 2 +- files/powermenu/type-1/powermenu.sh | 2 +- files/powermenu/type-1/shared/colors.rasi | 2 +- files/powermenu/type-2/powermenu.sh | 2 +- files/powermenu/type-2/shared/colors.rasi | 2 +- files/powermenu/type-3/powermenu.sh | 2 +- files/powermenu/type-3/shared/colors.rasi | 2 +- files/powermenu/type-4/powermenu.sh | 2 +- files/powermenu/type-4/shared/colors.rasi | 2 +- files/powermenu/type-5/powermenu.sh | 2 +- files/powermenu/type-6/powermenu.sh | 2 +- setup.sh | 35 +++++++++++++++++------ 33 files changed, 58 insertions(+), 41 deletions(-) diff --git a/files/applets/bin/appasroot.sh b/files/applets/bin/appasroot.sh index f0e6944..41bd193 100755 --- a/files/applets/bin/appasroot.sh +++ b/files/applets/bin/appasroot.sh @@ -6,7 +6,7 @@ ## Applets : Run Applications as Root # Import Current Theme -source "$HOME"/.config/rofi/applets/shared/theme.bash +source "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"/../shared/theme.bash theme="$type/$style" # Theme Elements diff --git a/files/applets/bin/apps.sh b/files/applets/bin/apps.sh index 01d1e4d..efb3e92 100755 --- a/files/applets/bin/apps.sh +++ b/files/applets/bin/apps.sh @@ -6,7 +6,7 @@ ## Applets : Favorite Applications # Import Current Theme -source "$HOME"/.config/rofi/applets/shared/theme.bash +source "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"/../shared/theme.bash theme="$type/$style" # Theme Elements diff --git a/files/applets/bin/battery.sh b/files/applets/bin/battery.sh index ef0dba6..50555db 100755 --- a/files/applets/bin/battery.sh +++ b/files/applets/bin/battery.sh @@ -6,7 +6,7 @@ ## Applets : Battery # Import Current Theme -source "$HOME"/.config/rofi/applets/shared/theme.bash +source "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"/../shared/theme.bash theme="$type/$style" # Battery Info diff --git a/files/applets/bin/brightness.sh b/files/applets/bin/brightness.sh index 2c90a12..b5bc571 100755 --- a/files/applets/bin/brightness.sh +++ b/files/applets/bin/brightness.sh @@ -6,7 +6,7 @@ ## Applets : Brightness # Import Current Theme -source "$HOME"/.config/rofi/applets/shared/theme.bash +source "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"/../shared/theme.bash theme="$type/$style" # Brightness Info diff --git a/files/applets/bin/mpd.sh b/files/applets/bin/mpd.sh index ce6a9e9..f53da26 100755 --- a/files/applets/bin/mpd.sh +++ b/files/applets/bin/mpd.sh @@ -6,7 +6,7 @@ ## Applets : MPD (music) # Import Current Theme -source "$HOME"/.config/rofi/applets/shared/theme.bash +source "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"/../shared/theme.bash theme="$type/$style" # Theme Elements diff --git a/files/applets/bin/powermenu.sh b/files/applets/bin/powermenu.sh index 8ed9106..ce11289 100755 --- a/files/applets/bin/powermenu.sh +++ b/files/applets/bin/powermenu.sh @@ -6,7 +6,7 @@ ## Applets : Power Menu # Import Current Theme -source "$HOME"/.config/rofi/applets/shared/theme.bash +source "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"/../shared/theme.bash theme="$type/$style" # Theme Elements diff --git a/files/applets/bin/quicklinks.sh b/files/applets/bin/quicklinks.sh index 11a38a8..0cf4881 100755 --- a/files/applets/bin/quicklinks.sh +++ b/files/applets/bin/quicklinks.sh @@ -6,7 +6,7 @@ ## Applets : Quick Links # Import Current Theme -source "$HOME"/.config/rofi/applets/shared/theme.bash +source "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"/../shared/theme.bash theme="$type/$style" # Theme Elements diff --git a/files/applets/bin/screenshot.sh b/files/applets/bin/screenshot.sh index 5e5286b..d7a6879 100755 --- a/files/applets/bin/screenshot.sh +++ b/files/applets/bin/screenshot.sh @@ -6,7 +6,7 @@ ## Applets : Screenshot # Import Current Theme -source "$HOME"/.config/rofi/applets/shared/theme.bash +source "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"/../shared/theme.bash theme="$type/$style" # Theme Elements diff --git a/files/applets/bin/volume.sh b/files/applets/bin/volume.sh index a194592..1110aa8 100755 --- a/files/applets/bin/volume.sh +++ b/files/applets/bin/volume.sh @@ -6,7 +6,7 @@ ## Applets : Volume # Import Current Theme -source "$HOME"/.config/rofi/applets/shared/theme.bash +source "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"/../shared/theme.bash theme="$type/$style" # Volume Info diff --git a/files/applets/shared/colors.rasi b/files/applets/shared/colors.rasi index 103ad63..66a0a2e 100644 --- a/files/applets/shared/colors.rasi +++ b/files/applets/shared/colors.rasi @@ -15,4 +15,4 @@ /* Import color-scheme from `colors` directory */ -@import "~/.config/rofi/colors/onedark.rasi" +@import "../../../colors/onedark.rasi" diff --git a/files/applets/shared/theme.bash b/files/applets/shared/theme.bash index 4807020..0697a72 100755 --- a/files/applets/shared/theme.bash +++ b/files/applets/shared/theme.bash @@ -1,4 +1,4 @@ ## Current Theme -type="$HOME/.config/rofi/applets/type-1" +type="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"/../type-1 style='style-1.rasi' diff --git a/files/launchers/type-1/launcher.sh b/files/launchers/type-1/launcher.sh index 85b7df4..e39e904 100755 --- a/files/launchers/type-1/launcher.sh +++ b/files/launchers/type-1/launcher.sh @@ -11,7 +11,7 @@ ## style-6 style-7 style-8 style-9 style-10 ## style-11 style-12 style-13 style-14 style-15 -dir="$HOME/.config/rofi/launchers/type-1" +dir="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" theme='style-1' ## Run diff --git a/files/launchers/type-1/shared/colors.rasi b/files/launchers/type-1/shared/colors.rasi index 103ad63..66a0a2e 100644 --- a/files/launchers/type-1/shared/colors.rasi +++ b/files/launchers/type-1/shared/colors.rasi @@ -15,4 +15,4 @@ /* Import color-scheme from `colors` directory */ -@import "~/.config/rofi/colors/onedark.rasi" +@import "../../../colors/onedark.rasi" diff --git a/files/launchers/type-2/launcher.sh b/files/launchers/type-2/launcher.sh index 3422cd7..e39e904 100755 --- a/files/launchers/type-2/launcher.sh +++ b/files/launchers/type-2/launcher.sh @@ -11,7 +11,7 @@ ## style-6 style-7 style-8 style-9 style-10 ## style-11 style-12 style-13 style-14 style-15 -dir="$HOME/.config/rofi/launchers/type-2" +dir="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" theme='style-1' ## Run diff --git a/files/launchers/type-2/shared/colors.rasi b/files/launchers/type-2/shared/colors.rasi index 103ad63..66a0a2e 100644 --- a/files/launchers/type-2/shared/colors.rasi +++ b/files/launchers/type-2/shared/colors.rasi @@ -15,4 +15,4 @@ /* Import color-scheme from `colors` directory */ -@import "~/.config/rofi/colors/onedark.rasi" +@import "../../../colors/onedark.rasi" diff --git a/files/launchers/type-3/launcher.sh b/files/launchers/type-3/launcher.sh index ae97b5f..1d6e6ec 100755 --- a/files/launchers/type-3/launcher.sh +++ b/files/launchers/type-3/launcher.sh @@ -10,7 +10,7 @@ ## style-1 style-2 style-3 style-4 style-5 ## style-6 style-7 style-8 style-9 style-10 -dir="$HOME/.config/rofi/launchers/type-3" +dir="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" theme='style-10' ## Run diff --git a/files/launchers/type-3/shared/colors.rasi b/files/launchers/type-3/shared/colors.rasi index 103ad63..66a0a2e 100644 --- a/files/launchers/type-3/shared/colors.rasi +++ b/files/launchers/type-3/shared/colors.rasi @@ -15,4 +15,4 @@ /* Import color-scheme from `colors` directory */ -@import "~/.config/rofi/colors/onedark.rasi" +@import "../../../colors/onedark.rasi" diff --git a/files/launchers/type-4/launcher.sh b/files/launchers/type-4/launcher.sh index 6572cda..fba55bc 100755 --- a/files/launchers/type-4/launcher.sh +++ b/files/launchers/type-4/launcher.sh @@ -10,7 +10,7 @@ ## style-1 style-2 style-3 style-4 style-5 ## style-6 style-7 style-8 style-9 style-10 -dir="$HOME/.config/rofi/launchers/type-4" +dir="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" theme='style-1' ## Run diff --git a/files/launchers/type-4/shared/colors.rasi b/files/launchers/type-4/shared/colors.rasi index 103ad63..66a0a2e 100644 --- a/files/launchers/type-4/shared/colors.rasi +++ b/files/launchers/type-4/shared/colors.rasi @@ -15,4 +15,4 @@ /* Import color-scheme from `colors` directory */ -@import "~/.config/rofi/colors/onedark.rasi" +@import "../../../colors/onedark.rasi" diff --git a/files/launchers/type-5/launcher.sh b/files/launchers/type-5/launcher.sh index e9d0a3a..a1cfb8c 100755 --- a/files/launchers/type-5/launcher.sh +++ b/files/launchers/type-5/launcher.sh @@ -9,7 +9,7 @@ # ## style-1 style-2 style-3 style-4 style-5 -dir="$HOME/.config/rofi/launchers/type-5" +dir="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" theme='style-1' ## Run diff --git a/files/launchers/type-6/launcher.sh b/files/launchers/type-6/launcher.sh index c0b4d33..fba55bc 100755 --- a/files/launchers/type-6/launcher.sh +++ b/files/launchers/type-6/launcher.sh @@ -10,7 +10,7 @@ ## style-1 style-2 style-3 style-4 style-5 ## style-6 style-7 style-8 style-9 style-10 -dir="$HOME/.config/rofi/launchers/type-6" +dir="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" theme='style-1' ## Run diff --git a/files/launchers/type-7/launcher.sh b/files/launchers/type-7/launcher.sh index aa45aa9..fba55bc 100755 --- a/files/launchers/type-7/launcher.sh +++ b/files/launchers/type-7/launcher.sh @@ -10,7 +10,7 @@ ## style-1 style-2 style-3 style-4 style-5 ## style-6 style-7 style-8 style-9 style-10 -dir="$HOME/.config/rofi/launchers/type-7" +dir="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" theme='style-1' ## Run diff --git a/files/powermenu/type-1/powermenu.sh b/files/powermenu/type-1/powermenu.sh index dd978af..facf578 100755 --- a/files/powermenu/type-1/powermenu.sh +++ b/files/powermenu/type-1/powermenu.sh @@ -10,7 +10,7 @@ ## style-1 style-2 style-3 style-4 style-5 # Current Theme -dir="$HOME/.config/rofi/powermenu/type-1" +dir="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" theme='style-1' # CMDs diff --git a/files/powermenu/type-1/shared/colors.rasi b/files/powermenu/type-1/shared/colors.rasi index 103ad63..66a0a2e 100644 --- a/files/powermenu/type-1/shared/colors.rasi +++ b/files/powermenu/type-1/shared/colors.rasi @@ -15,4 +15,4 @@ /* Import color-scheme from `colors` directory */ -@import "~/.config/rofi/colors/onedark.rasi" +@import "../../../colors/onedark.rasi" diff --git a/files/powermenu/type-2/powermenu.sh b/files/powermenu/type-2/powermenu.sh index 23d0795..0b60b25 100755 --- a/files/powermenu/type-2/powermenu.sh +++ b/files/powermenu/type-2/powermenu.sh @@ -11,7 +11,7 @@ ## style-6 style-7 style-8 style-9 style-10 # Current Theme -dir="$HOME/.config/rofi/powermenu/type-2" +dir="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" theme='style-1' # CMDs diff --git a/files/powermenu/type-2/shared/colors.rasi b/files/powermenu/type-2/shared/colors.rasi index 103ad63..66a0a2e 100644 --- a/files/powermenu/type-2/shared/colors.rasi +++ b/files/powermenu/type-2/shared/colors.rasi @@ -15,4 +15,4 @@ /* Import color-scheme from `colors` directory */ -@import "~/.config/rofi/colors/onedark.rasi" +@import "../../../colors/onedark.rasi" diff --git a/files/powermenu/type-3/powermenu.sh b/files/powermenu/type-3/powermenu.sh index 8c1e47f..ab4f91c 100755 --- a/files/powermenu/type-3/powermenu.sh +++ b/files/powermenu/type-3/powermenu.sh @@ -10,7 +10,7 @@ ## style-1 style-2 style-3 style-4 style-5 # Current Theme -dir="$HOME/.config/rofi/powermenu/type-3" +dir="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" theme='style-1' # CMDs diff --git a/files/powermenu/type-3/shared/colors.rasi b/files/powermenu/type-3/shared/colors.rasi index 103ad63..66a0a2e 100644 --- a/files/powermenu/type-3/shared/colors.rasi +++ b/files/powermenu/type-3/shared/colors.rasi @@ -15,4 +15,4 @@ /* Import color-scheme from `colors` directory */ -@import "~/.config/rofi/colors/onedark.rasi" +@import "../../../colors/onedark.rasi" diff --git a/files/powermenu/type-4/powermenu.sh b/files/powermenu/type-4/powermenu.sh index 17f20c7..18a815f 100755 --- a/files/powermenu/type-4/powermenu.sh +++ b/files/powermenu/type-4/powermenu.sh @@ -10,7 +10,7 @@ ## style-1 style-2 style-3 style-4 style-5 # Current Theme -dir="$HOME/.config/rofi/powermenu/type-4" +dir="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" theme='style-5' # CMDs diff --git a/files/powermenu/type-4/shared/colors.rasi b/files/powermenu/type-4/shared/colors.rasi index 103ad63..66a0a2e 100644 --- a/files/powermenu/type-4/shared/colors.rasi +++ b/files/powermenu/type-4/shared/colors.rasi @@ -15,4 +15,4 @@ /* Import color-scheme from `colors` directory */ -@import "~/.config/rofi/colors/onedark.rasi" +@import "../../../colors/onedark.rasi" diff --git a/files/powermenu/type-5/powermenu.sh b/files/powermenu/type-5/powermenu.sh index 561e30c..66443aa 100755 --- a/files/powermenu/type-5/powermenu.sh +++ b/files/powermenu/type-5/powermenu.sh @@ -10,7 +10,7 @@ ## style-1 style-2 style-3 style-4 style-5 # Current Theme -dir="$HOME/.config/rofi/powermenu/type-5" +dir="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" theme='style-1' # CMDs diff --git a/files/powermenu/type-6/powermenu.sh b/files/powermenu/type-6/powermenu.sh index ad93faf..afa8e7f 100755 --- a/files/powermenu/type-6/powermenu.sh +++ b/files/powermenu/type-6/powermenu.sh @@ -10,7 +10,7 @@ ## style-1 style-2 style-3 style-4 style-5 # Current Theme -dir="$HOME/.config/rofi/powermenu/type-6" +dir="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" theme='style-1' # CMDs diff --git a/setup.sh b/setup.sh index 52d365c..6c244a4 100755 --- a/setup.sh +++ b/setup.sh @@ -10,38 +10,53 @@ Color_Off='\033[0m' BBlack='\033[1;30m' BRed='\033[1;31m' BGreen='\033[1;32m' BYellow='\033[1;33m' BBlue='\033[1;34m' BPurple='\033[1;35m' BCyan='\033[1;36m' BWhite='\033[1;37m' + ## Directories ---------------------------- -DIR=`pwd` -FONT_DIR="$HOME/.local/share/fonts" -ROFI_DIR="$HOME/.config/rofi" +ROFI_INSTALL_DIR=$1 +FONT_INSTALL_DIR=$2 + +if [ -z "$ROFI_INSTALL_DIR" ]; then + ROFI_INSTALL_DIR="$HOME/.config/rofi" + FONT_DIR="$HOME/.local/share/fonts" + ROFI_DIR="$HOME/.config/rofi" +else + if [ -z "$FONT_INSTALL_DIR" ]; then + FONT_DIR="$ROFI_INSTALL_DIR/fonts" + else + FONT_DIR="$FONT_INSTALL_DIR" + fi + ROFI_DIR="$ROFI_INSTALL_DIR" +fi + +DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" # Install Fonts install_fonts() { - echo -e ${BBlue}"\n[*] Installing fonts..." ${Color_Off} + echo -e ${BBlue}"\n[*] Installing fonts to $FONT_DIR ${Color_Off}" if [[ -d "$FONT_DIR" ]]; then cp -rf $DIR/fonts/* "$FONT_DIR" else mkdir -p "$FONT_DIR" cp -rf $DIR/fonts/* "$FONT_DIR" fi - echo -e ${BYellow}"[*] Updating font cache...\n" ${Color_Off} + echo -e ${BYellow}"[*] Updating font cache" ${Color_Off} fc-cache } # Install Themes install_themes() { if [[ -d "$ROFI_DIR" ]]; then - echo -e ${BPurple}"[*] Creating a backup of your rofi configs..." ${Color_Off} + echo -e ${BPurple}"[*] Creating a backup of your rofi configs in ${ROFI_DIR}.${USER}" ${Color_Off} mv "$ROFI_DIR" "${ROFI_DIR}.${USER}" fi - echo -e ${BBlue}"[*] Installing rofi configs..." ${Color_Off} + echo -e ${BBlue}"[*] Installing rofi configs in $ROFI_DIR" ${Color_Off} { mkdir -p "$ROFI_DIR"; cp -rf $DIR/files/* "$ROFI_DIR"; } if [[ -f "$ROFI_DIR/config.rasi" ]]; then - echo -e ${BGreen}"[*] Successfully Installed.\n" ${Color_Off} + echo -e ${BGreen}"[*] Successfully Installed." ${Color_Off} exit 0 else - echo -e ${BRed}"[!] Failed to install.\n" ${Color_Off} + echo -e ${BRed}"[!] Failed to install." ${Color_Off} exit 1 fi } @@ -49,7 +64,9 @@ install_themes() { # Main main() { install_fonts + echo "" install_themes + echo "" } main From 323f94069c8977c5d9bc9cad5a74b10321c1c31e Mon Sep 17 00:00:00 2001 From: Jacoby6000 Date: Tue, 16 Jul 2024 19:36:40 -0500 Subject: [PATCH 2/7] 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`" From bd18d5972b81391892e04378b2f099c0ce6fdd67 Mon Sep 17 00:00:00 2001 From: Jacoby6000 Date: Tue, 16 Jul 2024 19:48:28 -0500 Subject: [PATCH 3/7] Allow applet script to search path relative to the script for cli input themes --- files/applets/bin/appasroot.sh | 21 +++++++++++++-------- files/applets/bin/apps.sh | 21 +++++++++++++-------- files/applets/bin/battery.sh | 21 +++++++++++++-------- files/applets/bin/brightness.sh | 21 +++++++++++++-------- files/applets/bin/mpd.sh | 21 +++++++++++++-------- files/applets/bin/powermenu.sh | 21 +++++++++++++-------- files/applets/bin/quicklinks.sh | 21 +++++++++++++-------- files/applets/bin/screenshot.sh | 21 +++++++++++++-------- files/applets/bin/volume.sh | 21 +++++++++++++-------- 9 files changed, 117 insertions(+), 72 deletions(-) diff --git a/files/applets/bin/appasroot.sh b/files/applets/bin/appasroot.sh index 64d6486..75a799a 100755 --- a/files/applets/bin/appasroot.sh +++ b/files/applets/bin/appasroot.sh @@ -6,19 +6,24 @@ ## 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 - echo "Theme not found!" - exit 1 + 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 fi diff --git a/files/applets/bin/apps.sh b/files/applets/bin/apps.sh index 25d34bc..07cb908 100755 --- a/files/applets/bin/apps.sh +++ b/files/applets/bin/apps.sh @@ -6,19 +6,24 @@ ## 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 - echo "Theme not found!" - exit 1 + 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 fi diff --git a/files/applets/bin/battery.sh b/files/applets/bin/battery.sh index f5deba5..d7fdd7c 100755 --- a/files/applets/bin/battery.sh +++ b/files/applets/bin/battery.sh @@ -6,19 +6,24 @@ ## 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 - echo "Theme not found!" - exit 1 + 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 fi diff --git a/files/applets/bin/brightness.sh b/files/applets/bin/brightness.sh index 62035aa..5fe23d1 100755 --- a/files/applets/bin/brightness.sh +++ b/files/applets/bin/brightness.sh @@ -6,19 +6,24 @@ ## 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 - echo "Theme not found!" - exit 1 + 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 fi diff --git a/files/applets/bin/mpd.sh b/files/applets/bin/mpd.sh index c7ffd8a..af61fce 100755 --- a/files/applets/bin/mpd.sh +++ b/files/applets/bin/mpd.sh @@ -6,19 +6,24 @@ ## 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 - echo "Theme not found!" - exit 1 + 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 fi diff --git a/files/applets/bin/powermenu.sh b/files/applets/bin/powermenu.sh index 56727a5..5b97fa7 100755 --- a/files/applets/bin/powermenu.sh +++ b/files/applets/bin/powermenu.sh @@ -6,19 +6,24 @@ ## 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 - echo "Theme not found!" - exit 1 + 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 fi diff --git a/files/applets/bin/quicklinks.sh b/files/applets/bin/quicklinks.sh index a8a20c6..d469ca8 100755 --- a/files/applets/bin/quicklinks.sh +++ b/files/applets/bin/quicklinks.sh @@ -6,19 +6,24 @@ ## 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 - echo "Theme not found!" - exit 1 + 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 fi diff --git a/files/applets/bin/screenshot.sh b/files/applets/bin/screenshot.sh index 7380ade..fd081bd 100755 --- a/files/applets/bin/screenshot.sh +++ b/files/applets/bin/screenshot.sh @@ -6,19 +6,24 @@ ## 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 - echo "Theme not found!" - exit 1 + 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 fi diff --git a/files/applets/bin/volume.sh b/files/applets/bin/volume.sh index d6bf62e..9b5ccb4 100755 --- a/files/applets/bin/volume.sh +++ b/files/applets/bin/volume.sh @@ -6,19 +6,24 @@ ## 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 - echo "Theme not found!" - exit 1 + 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 fi From 2ccb022c9504e75792ce7f62cd18e0e489a92d66 Mon Sep 17 00:00:00 2001 From: Jacoby6000 Date: Tue, 16 Jul 2024 21:36:51 -0500 Subject: [PATCH 4/7] More portability --- files/applets/bin/appasroot.sh | 20 ++---------------- files/applets/bin/apps.sh | 32 ++++++++--------------------- files/applets/bin/battery.sh | 21 ++----------------- files/applets/bin/brightness.sh | 20 ++---------------- files/applets/bin/mpd.sh | 20 ++---------------- files/applets/bin/powermenu.sh | 26 ++++++----------------- files/applets/bin/quicklinks.sh | 20 ++---------------- files/applets/bin/screenshot.sh | 21 ++----------------- files/applets/bin/volume.sh | 20 ++---------------- files/applets/shared/colors.rasi | 2 +- files/applets/shared/theme.bash | 26 +++++++++++++++++++++-- files/powermenu/type-1/powermenu.sh | 2 +- files/powermenu/type-2/powermenu.sh | 2 +- files/powermenu/type-3/powermenu.sh | 2 +- files/powermenu/type-4/powermenu.sh | 2 +- files/powermenu/type-5/powermenu.sh | 2 +- files/powermenu/type-6/powermenu.sh | 2 +- files/shared/uptime.sh | 21 +++++++++++++++++++ setup.sh | 21 ++++++++++--------- 19 files changed, 91 insertions(+), 191 deletions(-) create mode 100755 files/shared/uptime.sh diff --git a/files/applets/bin/appasroot.sh b/files/applets/bin/appasroot.sh index 75a799a..7d0cad7 100755 --- a/files/applets/bin/appasroot.sh +++ b/files/applets/bin/appasroot.sh @@ -6,26 +6,10 @@ ## Applets : Run Applications as Root # Import Current Theme +SCRIPT_INVOCATION="$0" 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 ]; - # 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 -fi +source "$SCRIPT_DIR/../shared/theme.bash" # Theme Elements prompt='Applications' diff --git a/files/applets/bin/apps.sh b/files/applets/bin/apps.sh index 07cb908..45fe37d 100755 --- a/files/applets/bin/apps.sh +++ b/files/applets/bin/apps.sh @@ -6,26 +6,10 @@ ## Applets : Favorite Applications # Import Current Theme +SCRIPT_INVOCATION="$0" 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 ]; - # 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 -fi +source "$SCRIPT_DIR/../shared/theme.bash" # Theme Elements @@ -41,12 +25,12 @@ elif [[ ( "$theme" == *'type-2'* ) || ( "$theme" == *'type-4'* ) ]]; then fi # CMDs (add your apps here) -term_cmd='alacritty' -file_cmd='thunar' -text_cmd='geany' -web_cmd='firefox' -music_cmd='alacritty -e ncmpcpp' -setting_cmd='xfce4-settings-manager' +term_cmd="${TERMINAL_CMD:-alacritty}" +file_cmd="${FILE_BROWSER_CMD:-thunar}" +text_cmd="${TEXT_EDITOR_CMD:-geany}" +web_cmd="${WEB_BROWSER_CMD:-firefox}" +music_cmd="${MUSIC_CMD:-alacritty -e ncmpcpp}" +setting_cmd="${SETTINGS_CMD:-xfce4-settings-manager}" # Options layout=`cat ${theme} | grep 'USE_ICON' | cut -d'=' -f2` diff --git a/files/applets/bin/battery.sh b/files/applets/bin/battery.sh index d7fdd7c..139eec3 100755 --- a/files/applets/bin/battery.sh +++ b/files/applets/bin/battery.sh @@ -6,27 +6,10 @@ ## Applets : Battery # Import Current Theme +SCRIPT_INVOCATION="$0" 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 ]; - # 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 -fi - +source "$SCRIPT_DIR/../shared/theme.bash" # 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 5fe23d1..7a0f820 100755 --- a/files/applets/bin/brightness.sh +++ b/files/applets/bin/brightness.sh @@ -6,26 +6,10 @@ ## Applets : Brightness # Import Current Theme +SCRIPT_INVOCATION="$0" 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 ]; - # 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 -fi +source "$SCRIPT_DIR/../shared/theme.bash" # Brightness Info backlight="$(printf "%.0f\n" `light -G`)" diff --git a/files/applets/bin/mpd.sh b/files/applets/bin/mpd.sh index af61fce..4c6db44 100755 --- a/files/applets/bin/mpd.sh +++ b/files/applets/bin/mpd.sh @@ -6,26 +6,10 @@ ## Applets : MPD (music) # Import Current Theme +SCRIPT_INVOCATION="$0" 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 ]; - # 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 -fi +source "$SCRIPT_DIR/../shared/theme.bash" # Theme Elements diff --git a/files/applets/bin/powermenu.sh b/files/applets/bin/powermenu.sh index 5b97fa7..6646908 100755 --- a/files/applets/bin/powermenu.sh +++ b/files/applets/bin/powermenu.sh @@ -6,31 +6,17 @@ ## Applets : Power Menu # Import Current Theme +SCRIPT_INVOCATION="$0" 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 ]; - # 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 -fi - +source "$SCRIPT_DIR/../shared/theme.bash" # Theme Elements prompt="`hostname`" -mesg="Uptime : `uptime -p | sed -e 's/up //g'`" + +uptime=$($SCRIPT_DIR/../../shared/uptime.sh) + +mesg="Uptime : $uptime" if [[ ( "$theme" == *'type-1'* ) || ( "$theme" == *'type-3'* ) || ( "$theme" == *'type-5'* ) ]]; then list_col='1' diff --git a/files/applets/bin/quicklinks.sh b/files/applets/bin/quicklinks.sh index d469ca8..9780b0e 100755 --- a/files/applets/bin/quicklinks.sh +++ b/files/applets/bin/quicklinks.sh @@ -6,26 +6,10 @@ ## Applets : Quick Links # Import Current Theme +SCRIPT_INVOCATION="$0" 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 ]; - # 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 -fi +source "$SCRIPT_DIR/../shared/theme.bash" # Theme Elements prompt='Quick Links' diff --git a/files/applets/bin/screenshot.sh b/files/applets/bin/screenshot.sh index fd081bd..fd9325c 100755 --- a/files/applets/bin/screenshot.sh +++ b/files/applets/bin/screenshot.sh @@ -6,27 +6,10 @@ ## Applets : Screenshot # Import Current Theme +SCRIPT_INVOCATION="$0" 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 ]; - # 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 -fi - +source "$SCRIPT_DIR/../shared/theme.bash" # Theme Elements prompt='Screenshot' diff --git a/files/applets/bin/volume.sh b/files/applets/bin/volume.sh index 9b5ccb4..830871d 100755 --- a/files/applets/bin/volume.sh +++ b/files/applets/bin/volume.sh @@ -6,26 +6,10 @@ ## Applets : Volume # Import Current Theme +SCRIPT_INVOCATION="$0" 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 ]; - # 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 -fi +source "$SCRIPT_DIR/../shared/theme.bash" # Volume Info diff --git a/files/applets/shared/colors.rasi b/files/applets/shared/colors.rasi index 66a0a2e..b208bcd 100644 --- a/files/applets/shared/colors.rasi +++ b/files/applets/shared/colors.rasi @@ -15,4 +15,4 @@ /* Import color-scheme from `colors` directory */ -@import "../../../colors/onedark.rasi" +@import "../../colors/onedark.rasi" diff --git a/files/applets/shared/theme.bash b/files/applets/shared/theme.bash index 0697a72..46fe5a8 100755 --- a/files/applets/shared/theme.bash +++ b/files/applets/shared/theme.bash @@ -1,4 +1,26 @@ ## Current Theme +DEFAULT_TYPE='type-1' +DEFAULT_STYLE='style-1' -type="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"/../type-1 -style='style-1.rasi' +echo $SCRIPT_DIR + +# INPUT_THEME should be set by the script that sources this file, +# if the user wants to override the default theme. +if [ -z "$INPUT_THEME" ]; then + theme="$SCRIPT_DIR/../$DEFAULT_TYPE/$DEFAULT_STYLE.rasi" +elif [[ $1 == "-h" || $1 == "--help" ]]; then + echo "Usage: $SCRIPT_INVOCATION [theme]" + exit 0 +else + theme="$INPUT_THEME" + if [ ! -d $theme ]; then + # 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 + fi +fi diff --git a/files/powermenu/type-1/powermenu.sh b/files/powermenu/type-1/powermenu.sh index 73a6946..e62eca7 100755 --- a/files/powermenu/type-1/powermenu.sh +++ b/files/powermenu/type-1/powermenu.sh @@ -27,7 +27,7 @@ fi # CMDs -uptime="`uptime -p | sed -e 's/up //g'`" +uptime=$($dir/../../shared/uptime.sh) host=`hostname` # Options diff --git a/files/powermenu/type-2/powermenu.sh b/files/powermenu/type-2/powermenu.sh index c984006..e9d29b9 100755 --- a/files/powermenu/type-2/powermenu.sh +++ b/files/powermenu/type-2/powermenu.sh @@ -28,7 +28,7 @@ fi # CMDs -uptime="`uptime -p | sed -e 's/up //g'`" +uptime=$($dir/../../shared/uptime.sh) host=`hostname` # Options diff --git a/files/powermenu/type-3/powermenu.sh b/files/powermenu/type-3/powermenu.sh index a6a7ac3..b743492 100755 --- a/files/powermenu/type-3/powermenu.sh +++ b/files/powermenu/type-3/powermenu.sh @@ -27,7 +27,7 @@ fi # CMDs -uptime="`uptime -p | sed -e 's/up //g'`" +uptime=$($dir/../../shared/uptime.sh) host=`hostname` # Options diff --git a/files/powermenu/type-4/powermenu.sh b/files/powermenu/type-4/powermenu.sh index 6cd8ee5..96ca18d 100755 --- a/files/powermenu/type-4/powermenu.sh +++ b/files/powermenu/type-4/powermenu.sh @@ -27,7 +27,7 @@ fi # CMDs -uptime="`uptime -p | sed -e 's/up //g'`" +uptime=$($dir/../../shared/uptime.sh) host=`hostname` # Options diff --git a/files/powermenu/type-5/powermenu.sh b/files/powermenu/type-5/powermenu.sh index ee855ac..169dcd4 100755 --- a/files/powermenu/type-5/powermenu.sh +++ b/files/powermenu/type-5/powermenu.sh @@ -28,7 +28,7 @@ fi # CMDs lastlogin="`last $USER | head -n1 | tr -s ' ' | cut -d' ' -f5,6,7`" -uptime="`uptime -p | sed -e 's/up //g'`" +uptime=$($dir/../../shared/uptime.sh) host=`hostname` # Options diff --git a/files/powermenu/type-6/powermenu.sh b/files/powermenu/type-6/powermenu.sh index 3af3744..374c5a8 100755 --- a/files/powermenu/type-6/powermenu.sh +++ b/files/powermenu/type-6/powermenu.sh @@ -28,7 +28,7 @@ fi # CMDs lastlogin="`last $USER | head -n1 | tr -s ' ' | cut -d' ' -f5,6,7`" -uptime="`uptime -p | sed -e 's/up //g'`" +uptime=$($dir/../../shared/uptime.sh) host=`hostname` # Options diff --git a/files/shared/uptime.sh b/files/shared/uptime.sh new file mode 100755 index 0000000..884d79c --- /dev/null +++ b/files/shared/uptime.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash + +uptime_seconds=$(awk '{print $1}' /proc/uptime) +echo -n $(awk -v UP="$uptime_seconds" ' +BEGIN { + days = int(UP / 86400); + hours = int((UP % 86400) / 3600); + minutes = int((UP % 3600) / 60); + seconds = int(UP % 60); + if (days > 0) { + if (days == 1) { + printf "1 day, %d hours, %d minutes\n", hours, minutes; + } else { + printf "%d days, %d hours, %d minutes\n", days, hours, minutes; + } + } else if (hours > 0) { + printf "%d hours, %d minutes\n", hours, minutes; + } else { + printf "%d minutes\n", minutes; + } +}') diff --git a/setup.sh b/setup.sh index 6c244a4..3413abf 100755 --- a/setup.sh +++ b/setup.sh @@ -33,26 +33,27 @@ DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" # Install Fonts install_fonts() { echo -e ${BBlue}"\n[*] Installing fonts to $FONT_DIR ${Color_Off}" - if [[ -d "$FONT_DIR" ]]; then - cp -rf $DIR/fonts/* "$FONT_DIR" - else + + if [ ! -d "$FONT_DIR" ]; then mkdir -p "$FONT_DIR" - cp -rf $DIR/fonts/* "$FONT_DIR" fi + + cp -rf $DIR/fonts/* "$FONT_DIR" + echo -e ${BYellow}"[*] Updating font cache" ${Color_Off} fc-cache } # Install Themes install_themes() { - if [[ -d "$ROFI_DIR" ]]; then - echo -e ${BPurple}"[*] Creating a backup of your rofi configs in ${ROFI_DIR}.${USER}" ${Color_Off} + if [ -d "$ROFI_DIR" ]; then + echo -e ${BPurple}"[*] Creating a backup of your rofi configs in '${ROFI_DIR}.${USER}'" ${Color_Off} mv "$ROFI_DIR" "${ROFI_DIR}.${USER}" fi - echo -e ${BBlue}"[*] Installing rofi configs in $ROFI_DIR" ${Color_Off} + echo -e ${BBlue}"[*] Installing rofi configs in '$ROFI_DIR'" ${Color_Off} { mkdir -p "$ROFI_DIR"; cp -rf $DIR/files/* "$ROFI_DIR"; } - if [[ -f "$ROFI_DIR/config.rasi" ]]; then + if [ -f "$ROFI_DIR/config.rasi" ]; then echo -e ${BGreen}"[*] Successfully Installed." ${Color_Off} exit 0 else @@ -63,10 +64,10 @@ install_themes() { # Main main() { - install_fonts - echo "" install_themes echo "" + install_fonts + echo "" } main From 1d0689cb334c92797cbc3fd47a793f03a13802cf Mon Sep 17 00:00:00 2001 From: Jacoby6000 Date: Tue, 16 Jul 2024 21:45:11 -0500 Subject: [PATCH 5/7] remove awk --- files/shared/uptime.sh | 49 ++++++++++++++++++++++++++---------------- 1 file changed, 30 insertions(+), 19 deletions(-) diff --git a/files/shared/uptime.sh b/files/shared/uptime.sh index 884d79c..2b5a842 100755 --- a/files/shared/uptime.sh +++ b/files/shared/uptime.sh @@ -1,21 +1,32 @@ #!/usr/bin/env bash -uptime_seconds=$(awk '{print $1}' /proc/uptime) -echo -n $(awk -v UP="$uptime_seconds" ' -BEGIN { - days = int(UP / 86400); - hours = int((UP % 86400) / 3600); - minutes = int((UP % 3600) / 60); - seconds = int(UP % 60); - if (days > 0) { - if (days == 1) { - printf "1 day, %d hours, %d minutes\n", hours, minutes; - } else { - printf "%d days, %d hours, %d minutes\n", days, hours, minutes; - } - } else if (hours > 0) { - printf "%d hours, %d minutes\n", hours, minutes; - } else { - printf "%d minutes\n", minutes; - } -}') +uptime_seconds=$(cat /proc/uptime | sed 's/^\([0-9]\+\)\..*/\1/') + +# Format the uptime +days=$(( uptime_seconds / 86400 )) +hours=$(( (uptime_seconds % 86400) / 3600 )) +minutes=$(( (uptime_seconds % 3600) / 60 )) + +# Helper function for pluralization +pluralize() { + local value=$1 + local singular=$2 + local plural=$3 + if [ "$value" -eq 1 ]; then + echo "$value $singular" + else + echo "$value $plural" + fi +} + +# Construct the uptime string +if [ "$days" -gt 0 ]; then + uptime="$(pluralize $days day days), $(pluralize $hours hour hours), $(pluralize $minutes minute minutes)" +elif [ "$hours" -gt 0 ]; then + uptime="$(pluralize $hours hour hours), $(pluralize $minutes minute minutes)" +else + uptime="$(pluralize $minutes minute minutes)" +fi + +echo "$uptime" + From 4e5eb9aae5667ac863a19f42a6078c06080f2938 Mon Sep 17 00:00:00 2001 From: Jacoby6000 Date: Wed, 17 Jul 2024 00:06:27 -0500 Subject: [PATCH 6/7] reuse theme setup in powermenu and launcher scripts --- files/applets/shared/theme.bash | 17 +++++------------ files/applets/type-4/style-1.rasi | 2 +- files/applets/type-4/style-2.rasi | 2 +- files/applets/type-4/style-3.rasi | 2 +- files/applets/type-5/style-1.rasi | 2 +- files/applets/type-5/style-2.rasi | 2 +- files/applets/type-5/style-3.rasi | 2 +- files/launchers/type-1/launcher.sh | 22 +++++++--------------- files/launchers/type-2/launcher.sh | 21 +++++++-------------- files/launchers/type-3/launcher.sh | 21 ++++++++------------- files/launchers/type-4/launcher.sh | 24 +++++++++--------------- files/launchers/type-5/launcher.sh | 24 +++++++++--------------- files/launchers/type-5/style-1.rasi | 2 +- files/launchers/type-5/style-2.rasi | 2 +- files/launchers/type-5/style-5.rasi | 6 +++--- files/launchers/type-6/launcher.sh | 21 +++++++-------------- files/launchers/type-6/style-1.rasi | 2 +- files/launchers/type-6/style-10.rasi | 2 +- files/launchers/type-6/style-2.rasi | 2 +- files/launchers/type-6/style-3.rasi | 2 +- files/launchers/type-6/style-4.rasi | 2 +- files/launchers/type-6/style-5.rasi | 2 +- files/launchers/type-6/style-6.rasi | 2 +- files/launchers/type-6/style-7.rasi | 2 +- files/launchers/type-6/style-8.rasi | 2 +- files/launchers/type-6/style-9.rasi | 2 +- files/launchers/type-7/launcher.sh | 21 +++++++-------------- files/launchers/type-7/style-1.rasi | 2 +- files/launchers/type-7/style-10.rasi | 2 +- files/launchers/type-7/style-2.rasi | 2 +- files/launchers/type-7/style-3.rasi | 2 +- files/launchers/type-7/style-4.rasi | 2 +- files/launchers/type-7/style-5.rasi | 2 +- files/launchers/type-7/style-6.rasi | 2 +- files/launchers/type-7/style-7.rasi | 2 +- files/launchers/type-7/style-8.rasi | 2 +- files/launchers/type-7/style-9.rasi | 2 +- files/powermenu/type-1/powermenu.sh | 26 +++++++++----------------- files/powermenu/type-2/powermenu.sh | 26 +++++++++----------------- files/powermenu/type-3/powermenu.sh | 25 +++++++++---------------- files/powermenu/type-4/powermenu.sh | 26 ++++++++++---------------- files/powermenu/type-4/style-5.rasi | 2 +- files/powermenu/type-5/powermenu.sh | 25 +++++++++---------------- files/powermenu/type-5/style-1.rasi | 2 +- files/powermenu/type-5/style-2.rasi | 2 +- files/powermenu/type-5/style-3.rasi | 2 +- files/powermenu/type-5/style-4.rasi | 2 +- files/powermenu/type-5/style-5.rasi | 2 +- files/powermenu/type-6/powermenu.sh | 26 +++++++++----------------- files/powermenu/type-6/style-1.rasi | 4 ++-- files/powermenu/type-6/style-2.rasi | 4 ++-- files/powermenu/type-6/style-3.rasi | 4 ++-- files/powermenu/type-6/style-4.rasi | 4 ++-- files/powermenu/type-6/style-5.rasi | 4 ++-- files/shared/theme.sh | 24 ++++++++++++++++++++++++ 55 files changed, 185 insertions(+), 258 deletions(-) create mode 100755 files/shared/theme.sh diff --git a/files/applets/shared/theme.bash b/files/applets/shared/theme.bash index 46fe5a8..eeaa274 100755 --- a/files/applets/shared/theme.bash +++ b/files/applets/shared/theme.bash @@ -2,8 +2,6 @@ DEFAULT_TYPE='type-1' DEFAULT_STYLE='style-1' -echo $SCRIPT_DIR - # INPUT_THEME should be set by the script that sources this file, # if the user wants to override the default theme. if [ -z "$INPUT_THEME" ]; then @@ -12,15 +10,10 @@ elif [[ $1 == "-h" || $1 == "--help" ]]; then echo "Usage: $SCRIPT_INVOCATION [theme]" exit 0 else - theme="$INPUT_THEME" - if [ ! -d $theme ]; then - # 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 + theme="$SCRIPT_DIR/../$theme.rasi" + if [ ! -f "$theme" ]; then + # fail if we still can't find it. + echo "Theme not found!" + exit 1 fi fi diff --git a/files/applets/type-4/style-1.rasi b/files/applets/type-4/style-1.rasi index 1823c56..0c4a002 100644 --- a/files/applets/type-4/style-1.rasi +++ b/files/applets/type-4/style-1.rasi @@ -64,7 +64,7 @@ inputbar { border-radius: 0px; border-color: @selected; background-color: transparent; - background-image: url("~/.config/rofi/images/a.png", width); + background-image: url("./images/a.png", width); text-color: @foreground; children: [ "textbox-prompt-colon", "prompt"]; } diff --git a/files/applets/type-4/style-2.rasi b/files/applets/type-4/style-2.rasi index 40a98ac..b90ab22 100644 --- a/files/applets/type-4/style-2.rasi +++ b/files/applets/type-4/style-2.rasi @@ -64,7 +64,7 @@ inputbar { border-radius: 20px; border-color: @selected; background-color: transparent; - background-image: url("~/.config/rofi/images/d.png", width); + background-image: url("./images/d.png", width); text-color: @foreground; children: [ "dummy", "textbox-prompt-colon", "prompt", "dummy"]; } diff --git a/files/applets/type-4/style-3.rasi b/files/applets/type-4/style-3.rasi index 0199650..2280c67 100644 --- a/files/applets/type-4/style-3.rasi +++ b/files/applets/type-4/style-3.rasi @@ -64,7 +64,7 @@ inputbar { border-radius: 40px; border-color: @selected; background-color: transparent; - background-image: url("~/.config/rofi/images/i.jpg", width); + background-image: url("./images/i.jpg", width); text-color: @foreground; children: [ "textbox-prompt-colon", "dummy", "prompt"]; } diff --git a/files/applets/type-5/style-1.rasi b/files/applets/type-5/style-1.rasi index 0fdc43d..15fbf9e 100644 --- a/files/applets/type-5/style-1.rasi +++ b/files/applets/type-5/style-1.rasi @@ -59,7 +59,7 @@ mainbox { /*****----- Imagebox -----*****/ imagebox { background-color: transparent; - background-image: url("~/.config/rofi/images/e.jpg", height); + background-image: url("./images/e.jpg", height); children: [ "dummy", "inputbar", "dummy" ]; } diff --git a/files/applets/type-5/style-2.rasi b/files/applets/type-5/style-2.rasi index 5b9c5b1..aee5de0 100644 --- a/files/applets/type-5/style-2.rasi +++ b/files/applets/type-5/style-2.rasi @@ -60,7 +60,7 @@ mainbox { imagebox { border-radius: 20px; background-color: transparent; - background-image: url("~/.config/rofi/images/j.jpg", height); + background-image: url("./images/j.jpg", height); children: [ "dummy", "inputbar", "dummy" ]; } diff --git a/files/applets/type-5/style-3.rasi b/files/applets/type-5/style-3.rasi index 416f51b..58bc082 100644 --- a/files/applets/type-5/style-3.rasi +++ b/files/applets/type-5/style-3.rasi @@ -62,7 +62,7 @@ imagebox { border-radius: 100%; border-color: @selected; background-color: transparent; - background-image: url("~/.config/rofi/images/g.png", height); + background-image: url("./images/g.png", height); children: [ "dummy", "inputbar", "dummy" ]; } diff --git a/files/launchers/type-1/launcher.sh b/files/launchers/type-1/launcher.sh index 6e532c4..f8b464a 100755 --- a/files/launchers/type-1/launcher.sh +++ b/files/launchers/type-1/launcher.sh @@ -12,23 +12,15 @@ ## style-11 style-12 style-13 style-14 style-15 INPUT_THEME=$1 -dir="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" -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 +SCRIPT_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" +theme=$($SCRIPT_DIR/../../shared/theme.sh "$SCRIPT_DIR" '1' '15' "$INPUT_THEME") + +if [ $? -ne 0 ]; then + echo $theme + exit 1 fi - - ## Run rofi \ -show drun \ - -theme ${dir}/${theme}.rasi + -theme $theme diff --git a/files/launchers/type-2/launcher.sh b/files/launchers/type-2/launcher.sh index 1917b31..f8b464a 100755 --- a/files/launchers/type-2/launcher.sh +++ b/files/launchers/type-2/launcher.sh @@ -12,22 +12,15 @@ ## style-11 style-12 style-13 style-14 style-15 INPUT_THEME=$1 -dir="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" -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 +SCRIPT_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" +theme=$($SCRIPT_DIR/../../shared/theme.sh "$SCRIPT_DIR" '1' '15' "$INPUT_THEME") +if [ $? -ne 0 ]; then + echo $theme + exit 1 +fi ## Run rofi \ -show drun \ - -theme ${dir}/${theme}.rasi + -theme $theme diff --git a/files/launchers/type-3/launcher.sh b/files/launchers/type-3/launcher.sh index e694879..2d383bd 100755 --- a/files/launchers/type-3/launcher.sh +++ b/files/launchers/type-3/launcher.sh @@ -11,22 +11,17 @@ ## style-6 style-7 style-8 style-9 style-10 INPUT_THEME=$1 -dir="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" -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 +SCRIPT_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" +theme=$($SCRIPT_DIR/../../shared/theme.sh "$SCRIPT_DIR" '10' '10' "$INPUT_THEME") + +if [ $? -ne 0 ]; then + echo $theme + exit 1 fi + ## Run rofi \ -show drun \ - -theme ${dir}/${theme}.rasi + -theme $theme diff --git a/files/launchers/type-4/launcher.sh b/files/launchers/type-4/launcher.sh index 9f950ea..ee0c7f9 100755 --- a/files/launchers/type-4/launcher.sh +++ b/files/launchers/type-4/launcher.sh @@ -9,23 +9,17 @@ # ## 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]}")")" -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 +INPUT_THEME=$1 +SCRIPT_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" +theme=$($SCRIPT_DIR/../../shared/theme.sh "$SCRIPT_DIR" '1' '10' "$INPUT_THEME") + +if [ $? -ne 0 ]; then + echo $theme + exit 1 +fi ## Run rofi \ -show drun \ - -theme ${dir}/${theme}.rasi + -theme $theme diff --git a/files/launchers/type-5/launcher.sh b/files/launchers/type-5/launcher.sh index 6b5e812..e02b1d2 100755 --- a/files/launchers/type-5/launcher.sh +++ b/files/launchers/type-5/launcher.sh @@ -8,23 +8,17 @@ ## Available Styles # ## style-1 style-2 style-3 style-4 style-5 -INPUT_THEME=$1 -dir="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" -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 +INPUT_THEME=$1 +SCRIPT_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" +theme=$($SCRIPT_DIR/../../shared/theme.sh "$SCRIPT_DIR" '1' '5' "$INPUT_THEME") + +if [ $? -ne 0 ]; then + echo $theme + exit 1 +fi ## Run rofi \ -show drun \ - -theme ${dir}/${theme}.rasi + -theme $theme diff --git a/files/launchers/type-5/style-1.rasi b/files/launchers/type-5/style-1.rasi index 21d8cba..abc859a 100644 --- a/files/launchers/type-5/style-1.rasi +++ b/files/launchers/type-5/style-1.rasi @@ -39,7 +39,7 @@ window { border-radius: 0px; border-color: black; cursor: "default"; - background-image: url("~/.config/rofi/images/paper.png", none); + background-image: url("./images/paper.png", none); } /*****----- Main Box -----*****/ diff --git a/files/launchers/type-5/style-2.rasi b/files/launchers/type-5/style-2.rasi index 185718f..31073bd 100644 --- a/files/launchers/type-5/style-2.rasi +++ b/files/launchers/type-5/style-2.rasi @@ -41,7 +41,7 @@ window { padding: 0px; border-radius: 12px; cursor: "default"; - background-image: url("~/.config/rofi/images/gradient.png", width); + background-image: url("./images/gradient.png", width); } /*****----- Main Box -----*****/ diff --git a/files/launchers/type-5/style-5.rasi b/files/launchers/type-5/style-5.rasi index 60e4e22..1c21f27 100644 --- a/files/launchers/type-5/style-5.rasi +++ b/files/launchers/type-5/style-5.rasi @@ -42,7 +42,7 @@ window { border-radius: 20px; cursor: "default"; background-color: #162022; - background-image: url("~/.config/rofi/images/flowers-1.png", width); + background-image: url("./images/flowers-1.png", width); } /*****----- Main Box -----*****/ @@ -63,7 +63,7 @@ inputbar { border: 2px; border-radius: 20px; border-color: white; - background-image: url("~/.config/rofi/images/flowers-3.png", none); + background-image: url("./images/flowers-3.png", none); children: [ "textbox-prompt-colon", "entry" ]; } @@ -108,7 +108,7 @@ listview { border: 2px; border-radius: 20px; border-color: white; - background-image: url("~/.config/rofi/images/flowers-2.png", width); + background-image: url("./images/flowers-2.png", width); cursor: "default"; } diff --git a/files/launchers/type-6/launcher.sh b/files/launchers/type-6/launcher.sh index 9f950ea..85e3579 100755 --- a/files/launchers/type-6/launcher.sh +++ b/files/launchers/type-6/launcher.sh @@ -10,22 +10,15 @@ ## 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]}")")" -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 +SCRIPT_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" +theme=$($SCRIPT_DIR/../../shared/theme.sh "$SCRIPT_DIR" '1' '10' "$INPUT_THEME") +if [ $? -ne 0 ]; then + echo $theme + exit 1 +fi ## Run rofi \ -show drun \ - -theme ${dir}/${theme}.rasi + -theme $theme diff --git a/files/launchers/type-6/style-1.rasi b/files/launchers/type-6/style-1.rasi index 198a4e0..af3b0c7 100644 --- a/files/launchers/type-6/style-1.rasi +++ b/files/launchers/type-6/style-1.rasi @@ -60,7 +60,7 @@ mainbox { imagebox { padding: 20px; background-color: transparent; - background-image: url("~/.config/rofi/images/a.png", height); + background-image: url("./images/a.png", height); orientation: vertical; children: [ "inputbar", "dummy", "mode-switcher" ]; } diff --git a/files/launchers/type-6/style-10.rasi b/files/launchers/type-6/style-10.rasi index 07c375d..adfd9f3 100644 --- a/files/launchers/type-6/style-10.rasi +++ b/files/launchers/type-6/style-10.rasi @@ -60,7 +60,7 @@ mainbox { imagebox { padding: 20px; background-color: transparent; - background-image: url("~/.config/rofi/images/j.jpg", height); + background-image: url("./images/j.jpg", height); orientation: vertical; children: [ "inputbar", "dummy", "mode-switcher" ]; } diff --git a/files/launchers/type-6/style-2.rasi b/files/launchers/type-6/style-2.rasi index 66a1de6..e13563b 100644 --- a/files/launchers/type-6/style-2.rasi +++ b/files/launchers/type-6/style-2.rasi @@ -60,7 +60,7 @@ mainbox { imagebox { padding: 20px; background-color: transparent; - background-image: url("~/.config/rofi/images/b.png", height); + background-image: url("./images/b.png", height); orientation: vertical; children: [ "inputbar", "dummy", "mode-switcher" ]; } diff --git a/files/launchers/type-6/style-3.rasi b/files/launchers/type-6/style-3.rasi index a623e2f..d43cd0b 100644 --- a/files/launchers/type-6/style-3.rasi +++ b/files/launchers/type-6/style-3.rasi @@ -60,7 +60,7 @@ mainbox { imagebox { padding: 20px; background-color: transparent; - background-image: url("~/.config/rofi/images/c.png", height); + background-image: url("./images/c.png", height); orientation: vertical; children: [ "inputbar", "dummy", "mode-switcher" ]; } diff --git a/files/launchers/type-6/style-4.rasi b/files/launchers/type-6/style-4.rasi index ddf2be1..7260a58 100644 --- a/files/launchers/type-6/style-4.rasi +++ b/files/launchers/type-6/style-4.rasi @@ -60,7 +60,7 @@ mainbox { imagebox { padding: 20px; background-color: transparent; - background-image: url("~/.config/rofi/images/d.png", height); + background-image: url("./images/d.png", height); orientation: vertical; children: [ "inputbar", "dummy", "mode-switcher" ]; } diff --git a/files/launchers/type-6/style-5.rasi b/files/launchers/type-6/style-5.rasi index afc90fb..03cc6af 100644 --- a/files/launchers/type-6/style-5.rasi +++ b/files/launchers/type-6/style-5.rasi @@ -60,7 +60,7 @@ mainbox { imagebox { padding: 20px; background-color: transparent; - background-image: url("~/.config/rofi/images/e.jpg", height); + background-image: url("./images/e.jpg", height); orientation: vertical; children: [ "inputbar", "dummy", "mode-switcher" ]; } diff --git a/files/launchers/type-6/style-6.rasi b/files/launchers/type-6/style-6.rasi index 7056c85..12c6af3 100644 --- a/files/launchers/type-6/style-6.rasi +++ b/files/launchers/type-6/style-6.rasi @@ -60,7 +60,7 @@ mainbox { imagebox { padding: 20px; background-color: transparent; - background-image: url("~/.config/rofi/images/f.png", height); + background-image: url("./images/f.png", height); orientation: vertical; children: [ "inputbar", "dummy", "mode-switcher" ]; } diff --git a/files/launchers/type-6/style-7.rasi b/files/launchers/type-6/style-7.rasi index 77eed40..37f738b 100644 --- a/files/launchers/type-6/style-7.rasi +++ b/files/launchers/type-6/style-7.rasi @@ -60,7 +60,7 @@ mainbox { imagebox { padding: 20px; background-color: transparent; - background-image: url("~/.config/rofi/images/g.png", height); + background-image: url("./images/g.png", height); orientation: vertical; children: [ "inputbar", "dummy", "mode-switcher" ]; } diff --git a/files/launchers/type-6/style-8.rasi b/files/launchers/type-6/style-8.rasi index 235dad7..c3b66f8 100644 --- a/files/launchers/type-6/style-8.rasi +++ b/files/launchers/type-6/style-8.rasi @@ -60,7 +60,7 @@ mainbox { imagebox { padding: 20px; background-color: transparent; - background-image: url("~/.config/rofi/images/h.jpg", height); + background-image: url("./images/h.jpg", height); orientation: vertical; children: [ "inputbar", "dummy", "mode-switcher" ]; } diff --git a/files/launchers/type-6/style-9.rasi b/files/launchers/type-6/style-9.rasi index e30583f..63c6723 100644 --- a/files/launchers/type-6/style-9.rasi +++ b/files/launchers/type-6/style-9.rasi @@ -60,7 +60,7 @@ mainbox { imagebox { padding: 20px; background-color: transparent; - background-image: url("~/.config/rofi/images/i.jpg", height); + background-image: url("./images/i.jpg", height); orientation: vertical; children: [ "inputbar", "dummy", "mode-switcher" ]; } diff --git a/files/launchers/type-7/launcher.sh b/files/launchers/type-7/launcher.sh index 9f950ea..85e3579 100755 --- a/files/launchers/type-7/launcher.sh +++ b/files/launchers/type-7/launcher.sh @@ -10,22 +10,15 @@ ## 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]}")")" -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 +SCRIPT_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" +theme=$($SCRIPT_DIR/../../shared/theme.sh "$SCRIPT_DIR" '1' '10' "$INPUT_THEME") +if [ $? -ne 0 ]; then + echo $theme + exit 1 +fi ## Run rofi \ -show drun \ - -theme ${dir}/${theme}.rasi + -theme $theme diff --git a/files/launchers/type-7/style-1.rasi b/files/launchers/type-7/style-1.rasi index 092f4f8..04ea889 100644 --- a/files/launchers/type-7/style-1.rasi +++ b/files/launchers/type-7/style-1.rasi @@ -71,7 +71,7 @@ inputbar { spacing: 10px; padding: 80px 60px; background-color: transparent; - background-image: url("~/.config/rofi/images/a.png", width); + background-image: url("./images/a.png", width); text-color: @foreground; orientation: horizontal; children: [ "textbox-prompt-colon", "entry", "dummy", "mode-switcher" ]; diff --git a/files/launchers/type-7/style-10.rasi b/files/launchers/type-7/style-10.rasi index 124df89..f09c18e 100644 --- a/files/launchers/type-7/style-10.rasi +++ b/files/launchers/type-7/style-10.rasi @@ -71,7 +71,7 @@ inputbar { spacing: 0px; padding: 100px 40px; background-color: transparent; - background-image: url("~/.config/rofi/images/j.jpg", width); + background-image: url("./images/j.jpg", width); text-color: @foreground; orientation: horizontal; children: [ "textbox-prompt-colon", "entry" ]; diff --git a/files/launchers/type-7/style-2.rasi b/files/launchers/type-7/style-2.rasi index 40a2375..b07afc9 100644 --- a/files/launchers/type-7/style-2.rasi +++ b/files/launchers/type-7/style-2.rasi @@ -71,7 +71,7 @@ inputbar { spacing: 10px; padding: 80px 60px; background-color: transparent; - background-image: url("~/.config/rofi/images/b.png", width); + background-image: url("./images/b.png", width); text-color: @foreground; orientation: horizontal; children: [ "textbox-prompt-colon", "entry", "dummy", "mode-switcher" ]; diff --git a/files/launchers/type-7/style-3.rasi b/files/launchers/type-7/style-3.rasi index 6ac4900..27e666f 100644 --- a/files/launchers/type-7/style-3.rasi +++ b/files/launchers/type-7/style-3.rasi @@ -71,7 +71,7 @@ inputbar { spacing: 10px; padding: 100px 60px; background-color: transparent; - background-image: url("~/.config/rofi/images/c.png", width); + background-image: url("./images/c.png", width); text-color: @foreground; orientation: horizontal; children: [ "textbox-prompt-colon", "entry", "dummy", "mode-switcher" ]; diff --git a/files/launchers/type-7/style-4.rasi b/files/launchers/type-7/style-4.rasi index 9657878..b9b67a7 100644 --- a/files/launchers/type-7/style-4.rasi +++ b/files/launchers/type-7/style-4.rasi @@ -72,7 +72,7 @@ inputbar { spacing: 10px; padding: 40px 40px 155px; background-color: transparent; - background-image: url("~/.config/rofi/images/d.png", width); + background-image: url("./images/d.png", width); text-color: @foreground; orientation: horizontal; children: [ "textbox-prompt-colon", "entry" ]; diff --git a/files/launchers/type-7/style-5.rasi b/files/launchers/type-7/style-5.rasi index 0edb39d..c8fa22b 100644 --- a/files/launchers/type-7/style-5.rasi +++ b/files/launchers/type-7/style-5.rasi @@ -71,7 +71,7 @@ inputbar { spacing: 10px; padding: 80px 60px; background-color: transparent; - background-image: url("~/.config/rofi/images/e.jpg", width); + background-image: url("./images/e.jpg", width); text-color: @foreground; orientation: horizontal; children: [ "textbox-prompt-colon", "entry", "dummy", "mode-switcher" ]; diff --git a/files/launchers/type-7/style-6.rasi b/files/launchers/type-7/style-6.rasi index d500569..0f96037 100644 --- a/files/launchers/type-7/style-6.rasi +++ b/files/launchers/type-7/style-6.rasi @@ -71,7 +71,7 @@ inputbar { spacing: 10px; padding: 100px 60px; background-color: transparent; - background-image: url("~/.config/rofi/images/f.png", width); + background-image: url("./images/f.png", width); text-color: @foreground; orientation: horizontal; children: [ "textbox-prompt-colon", "entry", "dummy", "mode-switcher" ]; diff --git a/files/launchers/type-7/style-7.rasi b/files/launchers/type-7/style-7.rasi index 98d135b..11dfbe4 100644 --- a/files/launchers/type-7/style-7.rasi +++ b/files/launchers/type-7/style-7.rasi @@ -71,7 +71,7 @@ inputbar { spacing: 10px; padding: 100px 40px; background-color: transparent; - background-image: url("~/.config/rofi/images/g.png", width); + background-image: url("./images/g.png", width); text-color: @foreground; orientation: horizontal; children: [ "textbox-prompt-colon", "entry" ]; diff --git a/files/launchers/type-7/style-8.rasi b/files/launchers/type-7/style-8.rasi index 0ed4797..c9a41a8 100644 --- a/files/launchers/type-7/style-8.rasi +++ b/files/launchers/type-7/style-8.rasi @@ -71,7 +71,7 @@ inputbar { spacing: 10px; padding: 100px 60px; background-color: transparent; - background-image: url("~/.config/rofi/images/h.jpg", width); + background-image: url("./images/h.jpg", width); text-color: @foreground; orientation: horizontal; children: [ "textbox-prompt-colon", "entry", "dummy", "mode-switcher" ]; diff --git a/files/launchers/type-7/style-9.rasi b/files/launchers/type-7/style-9.rasi index ff3bf0a..aa26f5f 100644 --- a/files/launchers/type-7/style-9.rasi +++ b/files/launchers/type-7/style-9.rasi @@ -71,7 +71,7 @@ inputbar { spacing: 10px; padding: 80px 60px; background-color: transparent; - background-image: url("~/.config/rofi/images/i.jpg", width); + background-image: url("./images/i.jpg", width); text-color: @foreground; orientation: horizontal; children: [ "textbox-prompt-colon", "entry", "dummy", "mode-switcher" ]; diff --git a/files/powermenu/type-1/powermenu.sh b/files/powermenu/type-1/powermenu.sh index e62eca7..69992cb 100755 --- a/files/powermenu/type-1/powermenu.sh +++ b/files/powermenu/type-1/powermenu.sh @@ -9,25 +9,17 @@ # ## style-1 style-2 style-3 style-4 style-5 -# Current Theme INPUT_THEME=$1 -dir="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" -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 +SCRIPT_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" +theme=$($SCRIPT_DIR/../../shared/theme.sh "$SCRIPT_DIR" '1' '5' "$INPUT_THEME") + +if [ $? -ne 0 ]; then + echo $theme + exit 1 fi - # CMDs -uptime=$($dir/../../shared/uptime.sh) +uptime=$($SCRIPT_DIR/../../shared/uptime.sh) host=`hostname` # Options @@ -44,7 +36,7 @@ rofi_cmd() { rofi -dmenu \ -p "$host" \ -mesg "Uptime: $uptime" \ - -theme ${dir}/${theme}.rasi + -theme $theme } # Confirmation CMD @@ -57,7 +49,7 @@ confirm_cmd() { -dmenu \ -p 'Confirmation' \ -mesg 'Are you Sure?' \ - -theme ${dir}/${theme}.rasi + -theme $theme } # Ask for confirmation diff --git a/files/powermenu/type-2/powermenu.sh b/files/powermenu/type-2/powermenu.sh index e9d29b9..53e4f1c 100755 --- a/files/powermenu/type-2/powermenu.sh +++ b/files/powermenu/type-2/powermenu.sh @@ -10,25 +10,17 @@ ## style-1 style-2 style-3 style-4 style-5 ## style-6 style-7 style-8 style-9 style-10 -# Current Theme INPUT_THEME=$1 -dir="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" -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 +SCRIPT_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" +theme=$($SCRIPT_DIR/../../shared/theme.sh "$SCRIPT_DIR" '1' '10' "$INPUT_THEME") + +if [ $? -ne 0 ]; then + echo $theme + exit 1 fi - # CMDs -uptime=$($dir/../../shared/uptime.sh) +uptime=$($SCRIPT_DIR/../../shared/uptime.sh) host=`hostname` # Options @@ -45,7 +37,7 @@ rofi_cmd() { rofi -dmenu \ -p "Uptime: $uptime" \ -mesg "Uptime: $uptime" \ - -theme ${dir}/${theme}.rasi + -theme $theme } # Confirmation CMD @@ -58,7 +50,7 @@ confirm_cmd() { -dmenu \ -p 'Confirmation' \ -mesg 'Are you Sure?' \ - -theme ${dir}/${theme}.rasi + -theme $theme } # Ask for confirmation diff --git a/files/powermenu/type-3/powermenu.sh b/files/powermenu/type-3/powermenu.sh index b743492..f58d484 100755 --- a/files/powermenu/type-3/powermenu.sh +++ b/files/powermenu/type-3/powermenu.sh @@ -9,25 +9,18 @@ # ## style-1 style-2 style-3 style-4 style-5 -# Current Theme INPUT_THEME=$1 -dir="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" -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 +SCRIPT_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" +theme=$($SCRIPT_DIR/../../shared/theme.sh "$SCRIPT_DIR" '1' '5' "$INPUT_THEME") + +if [ $? -ne 0 ]; then + echo $theme + exit 1 fi # CMDs -uptime=$($dir/../../shared/uptime.sh) +uptime=$($SCRIPT_DIR/../../shared/uptime.sh) host=`hostname` # Options @@ -44,7 +37,7 @@ rofi_cmd() { rofi -dmenu \ -p "Uptime: $uptime" \ -mesg "Uptime: $uptime" \ - -theme ${dir}/${theme}.rasi + -theme $theme } # Confirmation CMD @@ -52,7 +45,7 @@ confirm_cmd() { rofi -dmenu \ -p 'Confirmation' \ -mesg 'Are you Sure?' \ - -theme ${dir}/shared/confirm.rasi + -theme ${SCRIPT_DIR}/shared/confirm.rasi } # Ask for confirmation diff --git a/files/powermenu/type-4/powermenu.sh b/files/powermenu/type-4/powermenu.sh index 96ca18d..16a6aa0 100755 --- a/files/powermenu/type-4/powermenu.sh +++ b/files/powermenu/type-4/powermenu.sh @@ -9,25 +9,19 @@ # ## style-1 style-2 style-3 style-4 style-5 -# Current Theme + INPUT_THEME=$1 -dir="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" -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 +SCRIPT_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" +theme=$($SCRIPT_DIR/../../shared/theme.sh "$SCRIPT_DIR" '5' '5' "$INPUT_THEME") + +if [ $? -ne 0 ]; then + echo $theme + exit 1 fi # CMDs -uptime=$($dir/../../shared/uptime.sh) +uptime=$($SCRIPT_DIR/../../shared/uptime.sh) host=`hostname` # Options @@ -44,7 +38,7 @@ rofi_cmd() { rofi -dmenu \ -p "Goodbye ${USER}" \ -mesg "Uptime: $uptime" \ - -theme ${dir}/${theme}.rasi + -theme $theme } # Confirmation CMD @@ -52,7 +46,7 @@ confirm_cmd() { rofi -dmenu \ -p 'Confirmation' \ -mesg 'Are you Sure?' \ - -theme ${dir}/shared/confirm.rasi + -theme ${SCRIPT_DIR}/shared/confirm.rasi } # Ask for confirmation diff --git a/files/powermenu/type-4/style-5.rasi b/files/powermenu/type-4/style-5.rasi index 96b483c..a630933 100644 --- a/files/powermenu/type-4/style-5.rasi +++ b/files/powermenu/type-4/style-5.rasi @@ -83,7 +83,7 @@ userimage { border-radius: 100%; border-color: white; background-color: transparent; - background-image: url("~/.config/rofi/images/user.jpeg", both); + background-image: url("./images/user.jpeg", both); } /*****----- Inputbar -----*****/ diff --git a/files/powermenu/type-5/powermenu.sh b/files/powermenu/type-5/powermenu.sh index 169dcd4..e6e3e34 100755 --- a/files/powermenu/type-5/powermenu.sh +++ b/files/powermenu/type-5/powermenu.sh @@ -9,26 +9,19 @@ # ## style-1 style-2 style-3 style-4 style-5 -# Current Theme INPUT_THEME=$1 -dir="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" -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 +SCRIPT_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" +theme=$($SCRIPT_DIR/../../shared/theme.sh "$SCRIPT_DIR" '1' '5' "$INPUT_THEME") + +if [ $? -ne 0 ]; then + echo $theme + exit 1 fi # CMDs lastlogin="`last $USER | head -n1 | tr -s ' ' | cut -d' ' -f5,6,7`" -uptime=$($dir/../../shared/uptime.sh) +uptime=$($SCRIPT_DIR/../../shared/uptime.sh) host=`hostname` # Options @@ -46,7 +39,7 @@ rofi_cmd() { rofi -dmenu \ -p " $USER@$host" \ -mesg " Last Login: $lastlogin |  Uptime: $uptime" \ - -theme ${dir}/${theme}.rasi + -theme $theme } # Confirmation CMD @@ -59,7 +52,7 @@ confirm_cmd() { -dmenu \ -p 'Confirmation' \ -mesg 'Are you Sure?' \ - -theme ${dir}/${theme}.rasi + -theme $theme } # Ask for confirmation diff --git a/files/powermenu/type-5/style-1.rasi b/files/powermenu/type-5/style-1.rasi index ed3633c..71bc03f 100644 --- a/files/powermenu/type-5/style-1.rasi +++ b/files/powermenu/type-5/style-1.rasi @@ -64,7 +64,7 @@ inputbar { spacing: 0px; padding: 100px 80px; background-color: transparent; - background-image: url("~/.config/rofi/images/a.png", width); + background-image: url("./images/a.png", width); children: [ "textbox-prompt-colon", "dummy","prompt"]; } diff --git a/files/powermenu/type-5/style-2.rasi b/files/powermenu/type-5/style-2.rasi index ae737ca..4320034 100644 --- a/files/powermenu/type-5/style-2.rasi +++ b/files/powermenu/type-5/style-2.rasi @@ -64,7 +64,7 @@ inputbar { spacing: 0px; padding: 100px 80px; background-color: transparent; - background-image: url("~/.config/rofi/images/d.png", width); + background-image: url("./images/d.png", width); children: [ "textbox-prompt-colon", "dummy","prompt"]; } diff --git a/files/powermenu/type-5/style-3.rasi b/files/powermenu/type-5/style-3.rasi index 6f80ee1..4b4efc6 100644 --- a/files/powermenu/type-5/style-3.rasi +++ b/files/powermenu/type-5/style-3.rasi @@ -64,7 +64,7 @@ inputbar { spacing: 0px; padding: 100px 40px; background-color: transparent; - background-image: url("~/.config/rofi/images/e.jpg", width); + background-image: url("./images/e.jpg", width); children: [ "textbox-prompt-colon", "dummy","prompt"]; } diff --git a/files/powermenu/type-5/style-4.rasi b/files/powermenu/type-5/style-4.rasi index 247693a..9d5af97 100644 --- a/files/powermenu/type-5/style-4.rasi +++ b/files/powermenu/type-5/style-4.rasi @@ -64,7 +64,7 @@ inputbar { spacing: 0px; padding: 150px 40px; background-color: transparent; - background-image: url("~/.config/rofi/images/i.jpg", width); + background-image: url("./images/i.jpg", width); children: [ "textbox-prompt-colon", "dummy","prompt"]; } diff --git a/files/powermenu/type-5/style-5.rasi b/files/powermenu/type-5/style-5.rasi index 4492512..266f888 100644 --- a/files/powermenu/type-5/style-5.rasi +++ b/files/powermenu/type-5/style-5.rasi @@ -64,7 +64,7 @@ inputbar { spacing: 20px; padding: 100px 40px; background-color: transparent; - background-image: url("~/.config/rofi/images/j.jpg", width); + background-image: url("./images/j.jpg", width); children: [ "textbox-prompt-colon", "prompt"]; } diff --git a/files/powermenu/type-6/powermenu.sh b/files/powermenu/type-6/powermenu.sh index 374c5a8..0a952b4 100755 --- a/files/powermenu/type-6/powermenu.sh +++ b/files/powermenu/type-6/powermenu.sh @@ -9,26 +9,18 @@ # ## style-1 style-2 style-3 style-4 style-5 -# Current Theme INPUT_THEME=$1 -dir="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" -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 +SCRIPT_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" +theme=$($SCRIPT_DIR/../../shared/theme.sh "$SCRIPT_DIR" '1' '5' "$INPUT_THEME") +if [ $? -ne 0 ]; then + echo $theme + exit 1 +fi # CMDs lastlogin="`last $USER | head -n1 | tr -s ' ' | cut -d' ' -f5,6,7`" -uptime=$($dir/../../shared/uptime.sh) +uptime=$($SCRIPT_DIR/../../shared/uptime.sh) host=`hostname` # Options @@ -46,7 +38,7 @@ rofi_cmd() { rofi -dmenu \ -p " $USER@$host" \ -mesg " Uptime: $uptime" \ - -theme ${dir}/${theme}.rasi + -theme $theme } # Confirmation CMD @@ -59,7 +51,7 @@ confirm_cmd() { -dmenu \ -p 'Confirmation' \ -mesg 'Are you Sure?' \ - -theme ${dir}/${theme}.rasi + -theme $theme } # Ask for confirmation diff --git a/files/powermenu/type-6/style-1.rasi b/files/powermenu/type-6/style-1.rasi index 2af8289..77cfef2 100644 --- a/files/powermenu/type-6/style-1.rasi +++ b/files/powermenu/type-6/style-1.rasi @@ -57,7 +57,7 @@ imagebox { spacing: 30px; padding: 30px; background-color: transparent; - background-image: url("~/.config/rofi/images/a.png", height); + background-image: url("./images/a.png", height); children: [ "inputbar", "dummy", "message" ]; } @@ -68,7 +68,7 @@ userimage { border-radius: 10px; border-color: @background-alt; background-color: transparent; - background-image: url("~/.config/rofi/images/a.png", height); + background-image: url("./images/a.png", height); } /*****----- Inputbar -----*****/ diff --git a/files/powermenu/type-6/style-2.rasi b/files/powermenu/type-6/style-2.rasi index f437590..04978ce 100644 --- a/files/powermenu/type-6/style-2.rasi +++ b/files/powermenu/type-6/style-2.rasi @@ -57,7 +57,7 @@ imagebox { spacing: 20px; padding: 20px; background-color: transparent; - background-image: url("~/.config/rofi/images/d.png", height); + background-image: url("./images/d.png", height); children: [ "inputbar", "dummy", "message" ]; } @@ -68,7 +68,7 @@ userimage { border-radius: 10px; border-color: @background-alt; background-color: transparent; - background-image: url("~/.config/rofi/images/d.png", height); + background-image: url("./images/d.png", height); } /*****----- Inputbar -----*****/ diff --git a/files/powermenu/type-6/style-3.rasi b/files/powermenu/type-6/style-3.rasi index c03a032..335bd28 100644 --- a/files/powermenu/type-6/style-3.rasi +++ b/files/powermenu/type-6/style-3.rasi @@ -57,7 +57,7 @@ imagebox { spacing: 0px; padding: 30px; background-color: transparent; - background-image: url("~/.config/rofi/images/e.jpg", width); + background-image: url("./images/e.jpg", width); children: [ "inputbar", "dummy", "message" ]; } @@ -68,7 +68,7 @@ userimage { border-radius: 10px; border-color: @background-alt; background-color: transparent; - background-image: url("~/.config/rofi/images/e.jpg", height); + background-image: url("./images/e.jpg", height); } /*****----- Inputbar -----*****/ diff --git a/files/powermenu/type-6/style-4.rasi b/files/powermenu/type-6/style-4.rasi index 89978d1..c82b723 100644 --- a/files/powermenu/type-6/style-4.rasi +++ b/files/powermenu/type-6/style-4.rasi @@ -59,7 +59,7 @@ imagebox { spacing: 0px; padding: 100px; background-color: transparent; - background-image: url("~/.config/rofi/images/i.jpg", height); + background-image: url("./images/i.jpg", height); children: [ "inputbar", "dummy", "message" ]; } @@ -70,7 +70,7 @@ userimage { border-radius: 0px; border-color: @background-alt; background-color: transparent; - background-image: url("~/.config/rofi/images/i.jpg", height); + background-image: url("./images/i.jpg", height); } /*****----- Inputbar -----*****/ diff --git a/files/powermenu/type-6/style-5.rasi b/files/powermenu/type-6/style-5.rasi index ad5525a..2bc4527 100644 --- a/files/powermenu/type-6/style-5.rasi +++ b/files/powermenu/type-6/style-5.rasi @@ -59,7 +59,7 @@ imagebox { spacing: 0px; padding: 100px; background-color: transparent; - background-image: url("~/.config/rofi/images/j.jpg", height); + background-image: url("./images/j.jpg", height); children: [ "inputbar", "dummy", "message" ]; } @@ -70,7 +70,7 @@ userimage { border-radius: 0px; border-color: @background-alt; background-color: transparent; - background-image: url("~/.config/rofi/images/j.jpg", height); + background-image: url("./images/j.jpg", height); } /*****----- Inputbar -----*****/ diff --git a/files/shared/theme.sh b/files/shared/theme.sh new file mode 100755 index 0000000..b4278f7 --- /dev/null +++ b/files/shared/theme.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash + +SOURCE_DIR=$1 +DEFAULT_THEME=$2 +MAX_THEME=$3 +INPUT_THEME=$4 + +if [ -z "$INPUT_THEME" ]; then + theme="$DEFAULT_THEME" +elif [[ "$INPUT_THEME" == "-h" || "$INPUT_THEME" == "--help" ]]; then + echo "Usage: $SOURCE_DIR [1..$MAX_THEME]" + exit 1 +elif [[ "$INPUT_THEME" -gt "$MAX_THEME" || "$INPUT_THEME" -lt 1 ]]; then + echo "Invalid theme number! Theme must be between 1 and $MAX_THEME" + exit 1 +else + theme="$SOURCE_DIR/style-$INPUT_THEME.rasi" + if [ ! -f "$theme" ]; then + echo "Theme not found at $theme" + exit 1 + fi +fi + +echo -n "$theme" From 6792338afc96fe8c7dd70e424fff12c25ea947ca Mon Sep 17 00:00:00 2001 From: Jacoby6000 Date: Wed, 17 Jul 2024 00:07:36 -0500 Subject: [PATCH 7/7] Fix default theme --- files/shared/theme.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/shared/theme.sh b/files/shared/theme.sh index b4278f7..8698951 100755 --- a/files/shared/theme.sh +++ b/files/shared/theme.sh @@ -6,7 +6,7 @@ MAX_THEME=$3 INPUT_THEME=$4 if [ -z "$INPUT_THEME" ]; then - theme="$DEFAULT_THEME" + theme="$SOURCE_DIR/style-$DEFAULT_THEME.rasi" elif [[ "$INPUT_THEME" == "-h" || "$INPUT_THEME" == "--help" ]]; then echo "Usage: $SOURCE_DIR [1..$MAX_THEME]" exit 1