mirror of
https://github.com/adi1090x/rofi.git
synced 2024-12-25 22:08:23 -05:00
More portability
This commit is contained in:
parent
bd18d5972b
commit
2ccb022c95
@ -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'
|
||||
|
@ -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`
|
||||
|
@ -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`"
|
||||
|
@ -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`)"
|
||||
|
@ -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
|
||||
|
@ -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'
|
||||
|
@ -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'
|
||||
|
@ -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'
|
||||
|
@ -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
|
||||
|
@ -15,4 +15,4 @@
|
||||
|
||||
/* Import color-scheme from `colors` directory */
|
||||
|
||||
@import "../../../colors/onedark.rasi"
|
||||
@import "../../colors/onedark.rasi"
|
||||
|
@ -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
|
||||
|
@ -27,7 +27,7 @@ fi
|
||||
|
||||
|
||||
# CMDs
|
||||
uptime="`uptime -p | sed -e 's/up //g'`"
|
||||
uptime=$($dir/../../shared/uptime.sh)
|
||||
host=`hostname`
|
||||
|
||||
# Options
|
||||
|
@ -28,7 +28,7 @@ fi
|
||||
|
||||
|
||||
# CMDs
|
||||
uptime="`uptime -p | sed -e 's/up //g'`"
|
||||
uptime=$($dir/../../shared/uptime.sh)
|
||||
host=`hostname`
|
||||
|
||||
# Options
|
||||
|
@ -27,7 +27,7 @@ fi
|
||||
|
||||
|
||||
# CMDs
|
||||
uptime="`uptime -p | sed -e 's/up //g'`"
|
||||
uptime=$($dir/../../shared/uptime.sh)
|
||||
host=`hostname`
|
||||
|
||||
# Options
|
||||
|
@ -27,7 +27,7 @@ fi
|
||||
|
||||
|
||||
# CMDs
|
||||
uptime="`uptime -p | sed -e 's/up //g'`"
|
||||
uptime=$($dir/../../shared/uptime.sh)
|
||||
host=`hostname`
|
||||
|
||||
# Options
|
||||
|
@ -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
|
||||
|
@ -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
21
files/shared/uptime.sh
Executable 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;
|
||||
}
|
||||
}')
|
21
setup.sh
21
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
|
||||
|
Loading…
Reference in New Issue
Block a user