From 790b4ecc7cb711d0bf90bc5ff0ee7174f6e8d3dd Mon Sep 17 00:00:00 2001 From: vinceliuice Date: Tue, 15 Oct 2024 14:35:29 +0800 Subject: [PATCH] Fixed #1147 --- shell/lib-flatpak.sh | 10 ++++++++-- shell/lib-install.sh | 10 +++++----- tweaks.sh | 2 +- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/shell/lib-flatpak.sh b/shell/lib-flatpak.sh index 14e6b843..93793439 100755 --- a/shell/lib-flatpak.sh +++ b/shell/lib-flatpak.sh @@ -33,6 +33,7 @@ pakitheme_gtk3() { prompt -i "Converting theme: $FLATPAK_THEME... \n" elif [[ "${theme}" == '' ]]; then prompt -e "Find other variant themes but could not locate deafult theme! \n" + prompt -s "You can run './install.sh' install theme first! \n" prompt -s "Run this with right options! >>> \n" prompt -i "-o, --opacity [$(IFS='|'; echo "${OPACITY_VARIANTS[*]}")]" prompt -i "-c, --color [$(IFS='|'; echo "${COLOR_VARIANTS[*]}")]" @@ -116,9 +117,14 @@ flatpak_remove() { local theme="$(destify ${4})" local scheme="$(destify ${5})" - if [[ -w "/root" ]]; then + local system_theme_dir="/var/lib/flatpak/runtime/org.gtk.Gtk3theme.${name}${color}${opacity}${alt}${theme}${scheme}" + local user_theme_dir="$HOME/.local/share/flatpak/runtime/org.gtk.Gtk3theme.${name}${color}${opacity}${alt}${theme}${scheme}" + + if [[ -d "$system_theme_dir" ]]; then sudo flatpak remove -y --system org.gtk.Gtk3theme.${name}${color}${opacity}${alt}${theme}${scheme} - else + fi + + if [[ -d "$user_theme_dir" ]]; then flatpak remove -y --user org.gtk.Gtk3theme.${name}${color}${opacity}${alt}${theme}${scheme} fi } diff --git a/shell/lib-install.sh b/shell/lib-install.sh index 8a4ccaeb..b0db7657 100755 --- a/shell/lib-install.sh +++ b/shell/lib-install.sh @@ -853,11 +853,11 @@ connect_flatpak() { } disconnect_flatpak() { - for color in "${colors[@]}"; do - for opacity in "${opacities[@]}"; do - for alt in "${alts[@]}"; do - for theme in "${themes[@]}"; do - for scheme in "${schemes[@]}"; do + for color in "${COLOR_VARIANTS[@]}"; do + for opacity in "${OPACITY_VARIANTS[@]}"; do + for alt in "${ALT_VARIANTS[@]}"; do + for theme in "${THEME_VARIANTS[@]}"; do + for scheme in "${SCHEME_VARIANTS[@]}"; do flatpak_remove "${color}" "${opacity}" "${alt}" "${theme}" "${scheme}" done done diff --git a/tweaks.sh b/tweaks.sh index d78ccdc6..01e1ecb3 100755 --- a/tweaks.sh +++ b/tweaks.sh @@ -228,7 +228,6 @@ while [[ $# -gt 0 ]]; do fi; shift ;; -F|--flatpak) flatpak="true"; signal_exit - prompt -w "Without options it will only install default themes\n" if ! has_command flatpak; then prompt -e "'${1}' ERROR: There's no Flatpak installed in your system" @@ -322,6 +321,7 @@ else if [[ "${flatpak}" == 'true' && "${gdm}" != 'true' ]]; then prompt -i "Connecting '${name}' themes to your Flatpak... \n" + prompt -w "Without options it will only install default themes\n" customize_theme; avoid_variant_duplicates; connect_flatpak prompt -s "Done! '${name}' theme has been connected to your Flatpak. \n" fi