From 50c52e6b735b0f963f176d0fb0458800103f1cde Mon Sep 17 00:00:00 2001 From: iVAN <88724353+ivan-hc@users.noreply.github.com> Date: Wed, 4 Sep 2024 14:40:44 +0200 Subject: [PATCH] Add new option "icon-theme" ...to allow launchers using custoom icon themes, see https://github.com/ivan-hc/AM/issues/922 --- APP-MANAGER | 5 +++-- modules/management.am | 21 +++++++++++++++++++++ 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/APP-MANAGER b/APP-MANAGER index 2cbbdc0ff..c913e9c71 100755 --- a/APP-MANAGER +++ b/APP-MANAGER @@ -1,6 +1,6 @@ #!/usr/bin/env bash -AMVERSION="8.1.1-2" +AMVERSION="8.2-beta1" # Determine main repository and branch AMREPO="https://raw.githubusercontent.com/ivan-hc/AM/main" @@ -287,7 +287,7 @@ _am_newrepo_check "$@" # COMPLETION LIST available_options="about add apikey backup clean config disable downgrade download enable extra files \ - home info install install-appimage launcher list lock neodb newrepo nolibfuse off on overwrite \ + home icon-theme info install install-appimage launcher list lock neodb newrepo nolibfuse off on overwrite \ purge query remove sandbox select sync template test unlock update --appimages --apps --byname \ --config --convert --debug --devmode-disable --devmode-enable --force-latest --home --launcher \ --less --pkg --rollback --disable-sandbox --sandbox --system --user" @@ -1095,6 +1095,7 @@ case "$1" in ;; 'backup'|'-b'|\ 'downgrade'|'--rollback'|\ + 'icon-theme'|\ 'launcher'|'--launcher'|\ 'lock'|'unlock'|\ 'nolibfuse'|\ diff --git a/modules/management.am b/modules/management.am index fe1ac9604..4d4c8c438 100644 --- a/modules/management.am +++ b/modules/management.am @@ -105,6 +105,15 @@ function _downgrade() { echo "ROLLBACK SUCCESSFUL!" } +# ICON THEME CHANGER +function _icon_theme() { + if [ "$AMCLI" = am ]; then + $SUDOCMD sed -i "s#Icon=$APPSPATH/$arg/icons/#Icon=#g" /usr/local/share/applications/"$arg"*AM.desktop 2>/dev/null + else + sed -i "s#Icon=$APPSPATH/$arg/icons/#Icon=#g" "$DATADIR"/applications/"$arg"*AM.desktop 2>/dev/null + fi +} + # LAUNCHER function _launcher_appimage_extract() { "$arg" --appimage-extract share/icons/*/*/* 1>/dev/null @@ -332,6 +341,18 @@ case "$1" in done ;; + 'icon-theme') + # Place local AppImages into the menu by dragging and dropping them into the terminal + if [ "$2" = "--all" ]; then + ARGS=$(find . -name 'remove' -printf "%h\n" 2>/dev/null | du -sh -- * 2>/dev/null | sort -rh | sed 's@.* @@') + else + ARGS="$(echo "$@" | cut -f2- -d ' ')" + fi + for arg in $ARGS; do + _icon_theme "${@}" + done + ;; + 'launcher'|'--launcher') # Place local AppImages into the menu by dragging and dropping them into the terminal ARGS="$(echo "$@" | cut -f2- -d ' ')"