mirror of
https://github.com/adi1090x/rofi.git
synced 2025-12-10 04:22:48 +01:00
The script looks at the directories 720p/ and 1080p/ and tries to generate a
new directory "{resolution}p" where the numbers are adjusted. It does this by
going through all files in the initial directories and scaling changed numbers
linearly.
For example: If a number is 2 for 720p, 3 for 1080p, and you generate for 1400p
You will end up with 4 for 1440p.
Likewise 5 (2+3) (720p) and 6 (3+3) (1080p) would yield 7 (4+3).
88 lines
1.7 KiB
Bash
Executable File
88 lines
1.7 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
# Install script for rofi themes
|
|
|
|
# Dirs
|
|
DIR=`pwd`
|
|
FONT_DIR="$HOME/.local/share/fonts"
|
|
ROFI_DIR="$HOME/.config/rofi"
|
|
|
|
# Install Fonts
|
|
install_fonts() {
|
|
echo -e "\n[*] Installing fonts..."
|
|
if [[ -d "$FONT_DIR" ]]; then
|
|
cp -rf $DIR/fonts/* "$FONT_DIR"
|
|
else
|
|
mkdir -p "$FONT_DIR"
|
|
cp -rf $DIR/fonts/* "$FONT_DIR"
|
|
fi
|
|
}
|
|
|
|
# Install Themes
|
|
install_themes() {
|
|
if [[ -d "$ROFI_DIR" ]]; then
|
|
echo -e "[*] Creating a backup of your rofi configs..."
|
|
mv "$ROFI_DIR" "${ROFI_DIR}.old"
|
|
{ mkdir -p "$ROFI_DIR"; cp -rf $DIR/$RES/* "$ROFI_DIR"; }
|
|
else
|
|
{ mkdir -p "$ROFI_DIR"; cp -rf $DIR/$RES/* "$ROFI_DIR"; }
|
|
fi
|
|
if [[ -f "$ROFI_DIR/config.rasi" ]]; then
|
|
echo -e "[*] Successfully Installed.\n"
|
|
exit 0
|
|
else
|
|
echo -e "[!] Failed to install.\n"
|
|
exit 1
|
|
fi
|
|
}
|
|
|
|
# Clean up RES variable
|
|
clean_up_RES() {
|
|
number_pattern='^[0-9]+p?$'
|
|
if [[ "${RES}" =~ ${number_pattern} ]]; then
|
|
RES="$(tr -d p <<<"$RES")p"
|
|
else
|
|
echo -e "Sorry, something went wrong when checking your" \
|
|
"custom resolution.\n"\
|
|
"Please enter the number of your resolution height" \
|
|
"in pixels, e.g. 1440."
|
|
exit 1
|
|
fi
|
|
}
|
|
|
|
# Main
|
|
main() {
|
|
clear
|
|
cat <<- EOF
|
|
[*] Installing Rofi Themes...
|
|
|
|
[*] Choose your screen resolution -
|
|
[1] 1920x1080
|
|
[2] 1366x768
|
|
[3] Custom (Run ./generate-custom-resolution-config.py first)
|
|
|
|
EOF
|
|
|
|
read -p "[?] Select Option : "
|
|
|
|
if [[ $REPLY == "1" ]]; then
|
|
RES='1080p'
|
|
install_fonts
|
|
install_themes
|
|
elif [[ $REPLY == "2" ]]; then
|
|
RES='720p'
|
|
install_fonts
|
|
install_themes
|
|
elif [[ $REPLY == "3" ]]; then
|
|
read -p "How many pixes high is your resolution? " RES
|
|
clean_up_RES
|
|
install_fonts
|
|
install_themes
|
|
else
|
|
echo -e "\n[!] Invalid Option, Exiting...\n"
|
|
exit 1
|
|
fi
|
|
}
|
|
|
|
main
|