From da070afeb91e7fbe10f6e99619a2762979c9c4b1 Mon Sep 17 00:00:00 2001 From: Vince Date: Wed, 23 Jun 2021 10:38:41 +0800 Subject: [PATCH] update --- README.md | 4 + wallpapers/README.md | 14 ++++ wallpapers/WhiteSur-dark.svg | 6 +- .../gnome-background-properties/Monterey.xml | 2 +- .../gnome-background-properties/WhiteSur.xml | 2 +- wallpapers/install-gnome-backgrounds.sh | 81 +++++++++++++------ 6 files changed, 78 insertions(+), 31 deletions(-) create mode 100644 wallpapers/README.md diff --git a/README.md b/README.md index 9573f856..fac7dd41 100644 --- a/README.md +++ b/README.md @@ -320,6 +320,10 @@ Note:


+

+ +

+

diff --git a/wallpapers/README.md b/wallpapers/README.md new file mode 100644 index 00000000..6f21a1a4 --- /dev/null +++ b/wallpapers/README.md @@ -0,0 +1,14 @@ + +# MacOS Wallpapers for linux desktop + +## WhiteSur (Big Sur) Wallpapers +![1](WhiteSur-light.png) +![2](WhiteSur-dark.png) + +## Monterey Wallpapers +![1](Monterey-light.png) +![2](Monterey-dark.png) + +## Installation + +### Install diff --git a/wallpapers/WhiteSur-dark.svg b/wallpapers/WhiteSur-dark.svg index 3fe2715f..391e377e 100644 --- a/wallpapers/WhiteSur-dark.svg +++ b/wallpapers/WhiteSur-dark.svg @@ -6,9 +6,9 @@ fill="none" version="1.1" id="svg282" - sodipodi:docname="BigSur-dark.svg" + sodipodi:docname="WhiteSur-dark.svg" inkscape:version="1.1 (c4e8f9ed74, 2021-05-24)" - inkscape:export-filename="/home/vince/Documents/GitHub/WhiteSur-gtk-theme/src/wallpapers/BigSur-dark.png" + inkscape:export-filename="/home/vince/Documents/GitHub/WhiteSur-gtk-theme/wallpapers/WhiteSur-dark.png" inkscape:export-xdpi="96" inkscape:export-ydpi="96" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" @@ -28,7 +28,7 @@ inkscape:cx="-2040.3177" inkscape:cy="-368.73211" inkscape:window-width="1920" - inkscape:window-height="932" + inkscape:window-height="942" inkscape:window-x="0" inkscape:window-y="28" inkscape:window-maximized="1" diff --git a/wallpapers/gnome-background-properties/Monterey.xml b/wallpapers/gnome-background-properties/Monterey.xml index 3e0db24f..d3e4e424 100644 --- a/wallpapers/gnome-background-properties/Monterey.xml +++ b/wallpapers/gnome-background-properties/Monterey.xml @@ -6,7 +6,7 @@ /usr/share/backgrounds/Monterey/Monterey-timed.xml zoom solid - #555555 + #ffffff #000000 diff --git a/wallpapers/gnome-background-properties/WhiteSur.xml b/wallpapers/gnome-background-properties/WhiteSur.xml index 6901b6ad..45aa4309 100644 --- a/wallpapers/gnome-background-properties/WhiteSur.xml +++ b/wallpapers/gnome-background-properties/WhiteSur.xml @@ -6,7 +6,7 @@ /usr/share/backgrounds/WhiteSur/WhiteSur-timed.xml zoom solid - #555555 + #ffffff #000000 diff --git a/wallpapers/install-gnome-backgrounds.sh b/wallpapers/install-gnome-backgrounds.sh index db274389..d05f8285 100755 --- a/wallpapers/install-gnome-backgrounds.sh +++ b/wallpapers/install-gnome-backgrounds.sh @@ -55,6 +55,7 @@ uninstall() { } while [[ $# -gt 0 ]]; do + PROG_ARGS+=("${1}") case "${1}" in -u|--uninstall) uninstall='true' @@ -99,19 +100,7 @@ if [[ "${#themes[@]}" -eq 0 ]] ; then themes=("${THEME_VARIANTS[@]}") fi -install_wallpaper() { - for theme in "${themes[@]}"; do - install "$theme" - done -} - -uninstall_wallpaper() { - for theme in "${themes[@]}"; do - uninstall "$theme" - done -} - -sudo_access() { +install_access() { # Error message prompt -e "\n [ Error! ] -> Run me as root ! " @@ -126,19 +115,59 @@ sudo_access() { } } -if [[ "$UID" -eq "$ROOT_UID" ]] && [[ "${uninstall}" != 'true' ]]; then - prompt -s ""; install_wallpaper - prompt -s "\n * All done!" - prompt -s "" -else - [[ "${uninstall}" != 'true' ]] && sudo_access -fi +uninstall_access() { + #Check if password is cached (if cache timestamp not expired yet) + sudo -n true 2> /dev/null && echo -if [[ "$UID" -eq "$ROOT_UID" ]] && [[ "${uninstall}" == 'true' ]]; then - prompt -s ""; uninstall_wallpaper - prompt -s "\n * All done!" - prompt -s "" + 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 +} + +install_wallpaper() { + if [[ "$UID" == "$ROOT_UID" ]]; then + echo + for theme in "${themes[@]}"; do + install "$theme" + 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 [[ "${uninstall}" != 'true' ]]; then + install_wallpaper else - prompt -i "\n Run this with sudo, try it again!" - exit 1 + uninstall_wallpaper fi