Use relative paths and readlink for portability

This commit is contained in:
Jacoby6000 2024-07-16 18:28:49 -05:00
parent 7ba824d491
commit 9060e5c6e1
33 changed files with 58 additions and 41 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -15,4 +15,4 @@
/* Import color-scheme from `colors` directory */
@import "~/.config/rofi/colors/onedark.rasi"
@import "../../../colors/onedark.rasi"

View File

@ -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'

View File

@ -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

View File

@ -15,4 +15,4 @@
/* Import color-scheme from `colors` directory */
@import "~/.config/rofi/colors/onedark.rasi"
@import "../../../colors/onedark.rasi"

View File

@ -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

View File

@ -15,4 +15,4 @@
/* Import color-scheme from `colors` directory */
@import "~/.config/rofi/colors/onedark.rasi"
@import "../../../colors/onedark.rasi"

View File

@ -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

View File

@ -15,4 +15,4 @@
/* Import color-scheme from `colors` directory */
@import "~/.config/rofi/colors/onedark.rasi"
@import "../../../colors/onedark.rasi"

View File

@ -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

View File

@ -15,4 +15,4 @@
/* Import color-scheme from `colors` directory */
@import "~/.config/rofi/colors/onedark.rasi"
@import "../../../colors/onedark.rasi"

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -15,4 +15,4 @@
/* Import color-scheme from `colors` directory */
@import "~/.config/rofi/colors/onedark.rasi"
@import "../../../colors/onedark.rasi"

View File

@ -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

View File

@ -15,4 +15,4 @@
/* Import color-scheme from `colors` directory */
@import "~/.config/rofi/colors/onedark.rasi"
@import "../../../colors/onedark.rasi"

View File

@ -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

View File

@ -15,4 +15,4 @@
/* Import color-scheme from `colors` directory */
@import "~/.config/rofi/colors/onedark.rasi"
@import "../../../colors/onedark.rasi"

View File

@ -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

View File

@ -15,4 +15,4 @@
/* Import color-scheme from `colors` directory */
@import "~/.config/rofi/colors/onedark.rasi"
@import "../../../colors/onedark.rasi"

View File

@ -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

View File

@ -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

View File

@ -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