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 ## Applets : Run Applications as Root
# Import Current Theme # 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="$type/$style"
# Theme Elements # Theme Elements

View File

@ -6,7 +6,7 @@
## Applets : Favorite Applications ## Applets : Favorite Applications
# Import Current Theme # 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="$type/$style"
# Theme Elements # Theme Elements

View File

@ -6,7 +6,7 @@
## Applets : Battery ## Applets : Battery
# Import Current Theme # 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="$type/$style"
# Battery Info # Battery Info

View File

@ -6,7 +6,7 @@
## Applets : Brightness ## Applets : Brightness
# Import Current Theme # 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="$type/$style"
# Brightness Info # Brightness Info

View File

@ -6,7 +6,7 @@
## Applets : MPD (music) ## Applets : MPD (music)
# Import Current Theme # 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="$type/$style"
# Theme Elements # Theme Elements

View File

@ -6,7 +6,7 @@
## Applets : Power Menu ## Applets : Power Menu
# Import Current Theme # 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="$type/$style"
# Theme Elements # Theme Elements

View File

@ -6,7 +6,7 @@
## Applets : Quick Links ## Applets : Quick Links
# Import Current Theme # 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="$type/$style"
# Theme Elements # Theme Elements

View File

@ -6,7 +6,7 @@
## Applets : Screenshot ## Applets : Screenshot
# Import Current Theme # 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="$type/$style"
# Theme Elements # Theme Elements

View File

@ -6,7 +6,7 @@
## Applets : Volume ## Applets : Volume
# Import Current Theme # 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="$type/$style"
# Volume Info # Volume Info

View File

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

View File

@ -1,4 +1,4 @@
## Current Theme ## Current Theme
type="$HOME/.config/rofi/applets/type-1" type="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"/../type-1
style='style-1.rasi' style='style-1.rasi'

View File

@ -11,7 +11,7 @@
## style-6 style-7 style-8 style-9 style-10 ## style-6 style-7 style-8 style-9 style-10
## style-11 style-12 style-13 style-14 style-15 ## 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' theme='style-1'
## Run ## Run

View File

@ -15,4 +15,4 @@
/* Import color-scheme from `colors` directory */ /* 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-6 style-7 style-8 style-9 style-10
## style-11 style-12 style-13 style-14 style-15 ## 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' theme='style-1'
## Run ## Run

View File

@ -15,4 +15,4 @@
/* Import color-scheme from `colors` directory */ /* 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-1 style-2 style-3 style-4 style-5
## style-6 style-7 style-8 style-9 style-10 ## 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' theme='style-10'
## Run ## Run

View File

@ -15,4 +15,4 @@
/* Import color-scheme from `colors` directory */ /* 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-1 style-2 style-3 style-4 style-5
## style-6 style-7 style-8 style-9 style-10 ## 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' theme='style-1'
## Run ## Run

View File

@ -15,4 +15,4 @@
/* Import color-scheme from `colors` directory */ /* 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 ## 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' theme='style-1'
## Run ## Run

View File

@ -10,7 +10,7 @@
## style-1 style-2 style-3 style-4 style-5 ## style-1 style-2 style-3 style-4 style-5
## style-6 style-7 style-8 style-9 style-10 ## 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' theme='style-1'
## Run ## Run

View File

@ -10,7 +10,7 @@
## style-1 style-2 style-3 style-4 style-5 ## style-1 style-2 style-3 style-4 style-5
## style-6 style-7 style-8 style-9 style-10 ## 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' theme='style-1'
## Run ## Run

View File

@ -10,7 +10,7 @@
## style-1 style-2 style-3 style-4 style-5 ## style-1 style-2 style-3 style-4 style-5
# Current Theme # Current Theme
dir="$HOME/.config/rofi/powermenu/type-1" dir="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
theme='style-1' theme='style-1'
# CMDs # CMDs

View File

@ -15,4 +15,4 @@
/* Import color-scheme from `colors` directory */ /* 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-6 style-7 style-8 style-9 style-10
# Current Theme # Current Theme
dir="$HOME/.config/rofi/powermenu/type-2" dir="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
theme='style-1' theme='style-1'
# CMDs # CMDs

View File

@ -15,4 +15,4 @@
/* Import color-scheme from `colors` directory */ /* 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-1 style-2 style-3 style-4 style-5
# Current Theme # Current Theme
dir="$HOME/.config/rofi/powermenu/type-3" dir="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
theme='style-1' theme='style-1'
# CMDs # CMDs

View File

@ -15,4 +15,4 @@
/* Import color-scheme from `colors` directory */ /* 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-1 style-2 style-3 style-4 style-5
# Current Theme # Current Theme
dir="$HOME/.config/rofi/powermenu/type-4" dir="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
theme='style-5' theme='style-5'
# CMDs # CMDs

View File

@ -15,4 +15,4 @@
/* Import color-scheme from `colors` directory */ /* 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-1 style-2 style-3 style-4 style-5
# Current Theme # Current Theme
dir="$HOME/.config/rofi/powermenu/type-5" dir="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
theme='style-1' theme='style-1'
# CMDs # CMDs

View File

@ -10,7 +10,7 @@
## style-1 style-2 style-3 style-4 style-5 ## style-1 style-2 style-3 style-4 style-5
# Current Theme # Current Theme
dir="$HOME/.config/rofi/powermenu/type-6" dir="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
theme='style-1' theme='style-1'
# CMDs # 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' 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' BBlue='\033[1;34m' BPurple='\033[1;35m' BCyan='\033[1;36m' BWhite='\033[1;37m'
## Directories ---------------------------- ## Directories ----------------------------
DIR=`pwd` 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" FONT_DIR="$HOME/.local/share/fonts"
ROFI_DIR="$HOME/.config/rofi" 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
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 if [[ -d "$FONT_DIR" ]]; then
cp -rf $DIR/fonts/* "$FONT_DIR" cp -rf $DIR/fonts/* "$FONT_DIR"
else else
mkdir -p "$FONT_DIR" mkdir -p "$FONT_DIR"
cp -rf $DIR/fonts/* "$FONT_DIR" cp -rf $DIR/fonts/* "$FONT_DIR"
fi fi
echo -e ${BYellow}"[*] Updating font cache...\n" ${Color_Off} echo -e ${BYellow}"[*] Updating font cache" ${Color_Off}
fc-cache fc-cache
} }
# Install Themes # Install Themes
install_themes() { install_themes() {
if [[ -d "$ROFI_DIR" ]]; then 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}" mv "$ROFI_DIR" "${ROFI_DIR}.${USER}"
fi 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"; } { 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.\n" ${Color_Off} echo -e ${BGreen}"[*] Successfully Installed." ${Color_Off}
exit 0 exit 0
else else
echo -e ${BRed}"[!] Failed to install.\n" ${Color_Off} echo -e ${BRed}"[!] Failed to install." ${Color_Off}
exit 1 exit 1
fi fi
} }
@ -49,7 +64,9 @@ install_themes() {
# Main # Main
main() { main() {
install_fonts install_fonts
echo ""
install_themes install_themes
echo ""
} }
main main