More portability

This commit is contained in:
Jacoby6000 2024-07-16 21:36:51 -05:00
parent bd18d5972b
commit 2ccb022c95
19 changed files with 91 additions and 191 deletions

View File

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

View File

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

View File

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

View File

@ -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`)"

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -27,7 +27,7 @@ fi
# CMDs
uptime="`uptime -p | sed -e 's/up //g'`"
uptime=$($dir/../../shared/uptime.sh)
host=`hostname`
# Options

View File

@ -28,7 +28,7 @@ fi
# CMDs
uptime="`uptime -p | sed -e 's/up //g'`"
uptime=$($dir/../../shared/uptime.sh)
host=`hostname`
# Options

View File

@ -27,7 +27,7 @@ fi
# CMDs
uptime="`uptime -p | sed -e 's/up //g'`"
uptime=$($dir/../../shared/uptime.sh)
host=`hostname`
# Options

View File

@ -27,7 +27,7 @@ fi
# CMDs
uptime="`uptime -p | sed -e 's/up //g'`"
uptime=$($dir/../../shared/uptime.sh)
host=`hostname`
# Options

View File

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

View File

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

21
files/shared/uptime.sh Executable file
View File

@ -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;
}
}')

View File

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