diff --git a/wallpapers/1080p/Monterey-dark.png b/wallpapers/1080p/Monterey-dark.png new file mode 100644 index 00000000..92dbd6f8 Binary files /dev/null and b/wallpapers/1080p/Monterey-dark.png differ diff --git a/wallpapers/1080p/Monterey-light.png b/wallpapers/1080p/Monterey-light.png new file mode 100644 index 00000000..02b27b07 Binary files /dev/null and b/wallpapers/1080p/Monterey-light.png differ diff --git a/wallpapers/1080p/WhiteSur-dark.png b/wallpapers/1080p/WhiteSur-dark.png new file mode 100644 index 00000000..4adc7919 Binary files /dev/null and b/wallpapers/1080p/WhiteSur-dark.png differ diff --git a/wallpapers/1080p/WhiteSur-light.png b/wallpapers/1080p/WhiteSur-light.png new file mode 100644 index 00000000..b270e4b6 Binary files /dev/null and b/wallpapers/1080p/WhiteSur-light.png differ diff --git a/wallpapers/2k/Monterey-dark.png b/wallpapers/2k/Monterey-dark.png new file mode 100644 index 00000000..59420630 Binary files /dev/null and b/wallpapers/2k/Monterey-dark.png differ diff --git a/wallpapers/2k/Monterey-light.png b/wallpapers/2k/Monterey-light.png new file mode 100644 index 00000000..7581afdf Binary files /dev/null and b/wallpapers/2k/Monterey-light.png differ diff --git a/wallpapers/2k/WhiteSur-dark.png b/wallpapers/2k/WhiteSur-dark.png new file mode 100644 index 00000000..2e648aa6 Binary files /dev/null and b/wallpapers/2k/WhiteSur-dark.png differ diff --git a/wallpapers/2k/WhiteSur-light.png b/wallpapers/2k/WhiteSur-light.png new file mode 100644 index 00000000..75dfd5ab Binary files /dev/null and b/wallpapers/2k/WhiteSur-light.png differ diff --git a/wallpapers/4k/Monterey-dark.png b/wallpapers/4k/Monterey-dark.png new file mode 100644 index 00000000..5eac2080 Binary files /dev/null and b/wallpapers/4k/Monterey-dark.png differ diff --git a/wallpapers/4k/Monterey-light.png b/wallpapers/4k/Monterey-light.png new file mode 100644 index 00000000..1b72460b Binary files /dev/null and b/wallpapers/4k/Monterey-light.png differ diff --git a/wallpapers/4k/WhiteSur-dark.png b/wallpapers/4k/WhiteSur-dark.png new file mode 100644 index 00000000..f73031b1 Binary files /dev/null and b/wallpapers/4k/WhiteSur-dark.png differ diff --git a/wallpapers/4k/WhiteSur-light.png b/wallpapers/4k/WhiteSur-light.png new file mode 100644 index 00000000..a845f9d6 Binary files /dev/null and b/wallpapers/4k/WhiteSur-light.png differ diff --git a/wallpapers/Monterey-dark.png b/wallpapers/Monterey-dark.png deleted file mode 100644 index d93ad4bd..00000000 Binary files a/wallpapers/Monterey-dark.png and /dev/null differ diff --git a/wallpapers/Monterey-light.png b/wallpapers/Monterey-light.png deleted file mode 100644 index fa11221a..00000000 Binary files a/wallpapers/Monterey-light.png and /dev/null differ diff --git a/wallpapers/Monterey/Monterey-dark.png b/wallpapers/Monterey/Monterey-dark.png deleted file mode 100644 index d93ad4bd..00000000 Binary files a/wallpapers/Monterey/Monterey-dark.png and /dev/null differ diff --git a/wallpapers/Monterey/Monterey-light.png b/wallpapers/Monterey/Monterey-light.png deleted file mode 100644 index fa11221a..00000000 Binary files a/wallpapers/Monterey/Monterey-light.png and /dev/null differ diff --git a/wallpapers/WhiteSur-dark.png b/wallpapers/WhiteSur-dark.png deleted file mode 100644 index 5ede213e..00000000 Binary files a/wallpapers/WhiteSur-dark.png and /dev/null differ diff --git a/wallpapers/WhiteSur-light.png b/wallpapers/WhiteSur-light.png deleted file mode 100644 index 6edc9cdc..00000000 Binary files a/wallpapers/WhiteSur-light.png and /dev/null differ diff --git a/wallpapers/WhiteSur/WhiteSur-dark.png b/wallpapers/WhiteSur/WhiteSur-dark.png deleted file mode 100644 index 5ede213e..00000000 Binary files a/wallpapers/WhiteSur/WhiteSur-dark.png and /dev/null differ diff --git a/wallpapers/WhiteSur/WhiteSur-light.png b/wallpapers/WhiteSur/WhiteSur-light.png deleted file mode 100644 index 6edc9cdc..00000000 Binary files a/wallpapers/WhiteSur/WhiteSur-light.png and /dev/null differ diff --git a/wallpapers/install-gnome-backgrounds.sh b/wallpapers/install-gnome-backgrounds.sh index d05f8285..c6e87a52 100755 --- a/wallpapers/install-gnome-backgrounds.sh +++ b/wallpapers/install-gnome-backgrounds.sh @@ -8,6 +8,7 @@ BACKGROUND_DIR="/usr/share/backgrounds" PROPERTIES_DIR="/usr/share/gnome-background-properties" THEME_VARIANTS=('WhiteSur' 'Monterey') +SCREEN_VARIANTS=('1080p' '2k' '4k') #COLORS CDEF=" \033[0m" # default color @@ -38,13 +39,33 @@ prompt () { esac } +usage() { + cat << EOF +Usage: $0 [OPTION]... + +OPTIONS: + -t, --theme VARIANT Specify theme variant(s) [whitesur|monterey] (Default: All variants)s) + -s, --screen VARIANT Specify screen variant [1080p|2k|4k] (Default: 1080p) + -u, --uninstall Uninstall wallpappers + -h, --help Show help + +INSTALLATION EXAMPLES: +Install WhiteSur version on 4k display: + $0 -t whitesur -s 4k +EOF +} + install() { local theme="$1" - prompt -i "\n * Install ${theme} in ${BACKGROUND_DIR}... " + local screen="$2" + + prompt -i "\n * Install ${theme} ${screen} version in ${BACKGROUND_DIR}... " [[ -d ${BACKGROUND_DIR}/${theme} ]] && rm -rf ${BACKGROUND_DIR}/${theme} [[ -f ${PROPERTIES_DIR}/${theme}.xml ]] && rm -rf ${PROPERTIES_DIR}/${theme}.xml - cp -r ${REPO_DIR}/${theme} ${BACKGROUND_DIR} - cp -r ${REPO_DIR}/gnome-background-properties/${theme}.xml ${PROPERTIES_DIR} + mkdir -p ${BACKGROUND_DIR}/${theme} + cp -r ${REPO_DIR}/${screen}/${theme}{-dark,-light}.png ${BACKGROUND_DIR}/${theme} + cp -r ${REPO_DIR}/xml-files/timed-xml-files/${theme}-timed.xml ${BACKGROUND_DIR}/${theme} + cp -r ${REPO_DIR}/xml-files/gnome-background-properties/${theme}.xml ${PROPERTIES_DIR} } uninstall() { @@ -55,7 +76,6 @@ uninstall() { } while [[ $# -gt 0 ]]; do - PROG_ARGS+=("${1}") case "${1}" in -u|--uninstall) uninstall='true' @@ -77,8 +97,35 @@ while [[ $# -gt 0 ]]; do break ;; *) - echo "ERROR: Unrecognized color variant '$1'." - echo "Try '$0 --help' for more information." + prompt -e "ERROR: Unrecognized theme variant '$1'." + prompt -i "Try '$0 --help' for more information." + exit 1 + ;; + esac + done + ;; + -s|--screen) + shift + for screen in "$@"; do + case "$screen" in + 1080p) + screens+=("${SCREEN_VARIANTS[0]}") + shift 1 + ;; + 2k) + screens+=("${SCREEN_VARIANTS[1]}") + shift 1 + ;; + 4k) + screens+=("${SCREEN_VARIANTS[2]}") + shift 1 + ;; + -*) + break + ;; + *) + prompt -e "ERROR: Unrecognized screen variant '$1'." + prompt -i "Try '$0 --help' for more information." exit 1 ;; esac @@ -100,74 +147,39 @@ if [[ "${#themes[@]}" -eq 0 ]] ; then themes=("${THEME_VARIANTS[@]}") fi -install_access() { - # Error message - prompt -e "\n [ Error! ] -> Run me as root ! " - - # persisted execution of the script as root - read -p "[ Trusted ] Specify the root password : " -t${MAX_DELAY} -s - [[ -n "$REPLY" ]] && { - sudo -S <<< $REPLY $0 - } || { - clear - prompt -i "\n Operation canceled by user, Bye!" - exit 1 - } -} - -uninstall_access() { - #Check if password is cached (if cache timestamp not expired yet) - sudo -n true 2> /dev/null && echo - - if [[ $? == 0 ]]; then - #No need to ask for password - sudo "$0" "${PROG_ARGS[@]}" - else - #Ask for password - prompt -e "\n [ Error! ] -> Run me as root! " - read -p " [ Trusted ] Specify the root password : " -t ${MAX_DELAY} -s - - sudo -S echo <<< $REPLY 2> /dev/null && echo - - if [[ $? == 0 ]]; then - #Correct password, use with sudo's stdin - sudo -S "$0" "${PROG_ARGS[@]}" <<< $REPLY - else - #block for 3 seconds before allowing another attempt - sleep 3 - clear - prompt -e "\n [ Error! ] -> Incorrect password!\n" - exit 1 - fi - fi -} +if [[ "${#screens[@]}" -eq 0 ]] ; then + screens=("${SCREEN_VARIANTS[@]}") +fi install_wallpaper() { - if [[ "$UID" == "$ROOT_UID" ]]; then echo for theme in "${themes[@]}"; do - install "$theme" + for screen in "${screens[0]}"; do + install "$theme" "$screen" + done done - else - install_access echo - fi } uninstall_wallpaper() { - if [[ "$UID" == "$ROOT_UID" ]]; then echo for theme in "${themes[@]}"; do uninstall "$theme" done - else - uninstall_access echo - fi } +if [[ $UID -ne $ROOT_UID ]]; then + echo + prompt -e "ERROR: Need root access! please run this script with sudo." + echo + exit 1 +fi + if [[ "${uninstall}" != 'true' ]]; then install_wallpaper else uninstall_wallpaper fi + +prompt -s "Finished!" diff --git a/wallpapers/install-wallpapers.sh b/wallpapers/install-wallpapers.sh index be59ccaf..c473f462 100755 --- a/wallpapers/install-wallpapers.sh +++ b/wallpapers/install-wallpapers.sh @@ -5,6 +5,7 @@ WALLPAPER_DIR="$HOME/.local/share/backgrounds" THEME_VARIANTS=('WhiteSur' 'Monterey') COLOR_VARIANTS=('-light' '-dark') +SCREEN_VARIANTS=('1080p' '2k' '4k') #COLORS CDEF=" \033[0m" # default color @@ -35,13 +36,30 @@ prompt () { esac } +usage() { + cat << EOF +Usage: $0 [OPTION]... + +OPTIONS: + -t, --theme VARIANT Specify theme variant(s) [whitesur|monterey] (Default: All variants)s) + -c, --color VARIANT Specify color variant(s) [light|dark] (Default: All variants)s) + -s, --screen VARIANT Specify screen variant [1080p|2k|4k] (Default: 1080p) + -u, --uninstall Uninstall wallpappers + -h, --help Show help + +INSTALLATION EXAMPLES: +Install WhiteSur dark version on 4k display: + $0 -t whitesur -c dark -s 4k +EOF +} + install() { local theme="$1" local color="$2" + local screen="$3" prompt -i "\n * Install ${theme}${color} in ${WALLPAPER_DIR}... " - [[ -f ${WALLPAPER_DIR}/${theme}${color}.png ]] && rm -rf ${WALLPAPER_DIR}/${theme}${color}.png - cp -r ${REPO_DIR}/${theme}${color}.png ${WALLPAPER_DIR} + cp -r ${REPO_DIR}/${screen}/${theme}${color}.png ${WALLPAPER_DIR} } uninstall() { @@ -103,6 +121,33 @@ while [[ $# -gt 0 ]]; do esac done ;; + -s|--screen) + shift + for screen in "$@"; do + case "$screen" in + 1080p) + screens+=("${SCREEN_VARIANTS[0]}") + shift 1 + ;; + 2k) + screens+=("${SCREEN_VARIANTS[1]}") + shift 1 + ;; + 4k) + screens+=("${SCREEN_VARIANTS[2]}") + shift 1 + ;; + -*) + break + ;; + *) + echo "ERROR: Unrecognized color variant '$1'." + echo "Try '$0 --help' for more information." + exit 1 + ;; + esac + done + ;; -h|--help) usage exit 0 @@ -123,10 +168,16 @@ if [[ "${#colors[@]}" -eq 0 ]] ; then colors=("${COLOR_VARIANTS[@]}") fi +if [[ "${#screens[@]}" -eq 0 ]] ; then + screens=("${SCREEN_VARIANTS[0]}") +fi + install_wallpaper() { for theme in "${themes[@]}"; do for color in "${colors[@]}"; do - install "$theme" "$color" + for screen in "${screens[@]}"; do + install "$theme" "$color" "$screen" + done done done } diff --git a/wallpapers/render-wallpapers.sh b/wallpapers/render-wallpapers.sh new file mode 100755 index 00000000..e79f54ac --- /dev/null +++ b/wallpapers/render-wallpapers.sh @@ -0,0 +1,35 @@ +#!/bin/bash + +INKSCAPE="$(command -v inkscape)" || true +OPTIPNG="$(command -v optipng)" || true + +for theme in 'Monterey' 'WhiteSur'; do + for screen in '1080p' '2k' '4k'; do + for color in '-light' '-dark'; do + +if [[ "${screen}" == '1080p' ]]; then + DPI="96" +elif [[ "${screen}" == '2k' ]]; then + DPI="128" +elif [[ "${screen}" == '4k' ]]; then + DPI="192" +fi + +SRC_FILE="${theme}${color}.svg" +PNG_file="${screen}/${theme}${color}.png" + +if [[ -f "$PNG_file" ]]; then + echo "'$PNG_file' exist! " +else + echo "Rendering '$PNG_file'" + "$INKSCAPE" --export-dpi="$DPI" \ + --export-filename="$PNG_file" "$SRC_FILE" >/dev/null + + if [[ -n "${OPTIPNG}" ]]; then + "$OPTIPNG" -o7 --quiet "$PNG_file" + fi +fi + + done + done +done diff --git a/wallpapers/gnome-background-properties/Monterey.xml b/wallpapers/xml-files/gnome-background-properties/Monterey.xml similarity index 100% rename from wallpapers/gnome-background-properties/Monterey.xml rename to wallpapers/xml-files/gnome-background-properties/Monterey.xml diff --git a/wallpapers/gnome-background-properties/WhiteSur.xml b/wallpapers/xml-files/gnome-background-properties/WhiteSur.xml similarity index 100% rename from wallpapers/gnome-background-properties/WhiteSur.xml rename to wallpapers/xml-files/gnome-background-properties/WhiteSur.xml diff --git a/wallpapers/Monterey/Monterey-timed.xml b/wallpapers/xml-files/timed-xml-files/Monterey-timed.xml similarity index 100% rename from wallpapers/Monterey/Monterey-timed.xml rename to wallpapers/xml-files/timed-xml-files/Monterey-timed.xml diff --git a/wallpapers/WhiteSur/WhiteSur-timed.xml b/wallpapers/xml-files/timed-xml-files/WhiteSur-timed.xml similarity index 100% rename from wallpapers/WhiteSur/WhiteSur-timed.xml rename to wallpapers/xml-files/timed-xml-files/WhiteSur-timed.xml