Skip to content

Commit

Permalink
Merge pull request #925 from Samueru-sama/dev
Browse files Browse the repository at this point in the history
Add .png or .svg symlinks to icons management.am
  • Loading branch information
ivan-hc authored Sep 5, 2024
2 parents 789974a + 675c770 commit d148f58
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions modules/management.am
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,17 @@ function _downgrade() {

# ICON THEME CHANGER
function _icon_theme_export_to_datadir() {
[ -d "$APPSPATH/$arg/icons" ] && mkdir -p "$DATADIR"/icons \
&& find "$APPSPATH"/"$arg"/icons -type f ! -name "*.*" -exec cp {} {}.png \; \
&& rsync -avq "$APPSPATH"/"$arg"/icons/*.png "$DATADIR"/icons/ && rm -f "$APPSPATH"/"$arg"/icons/*.png
PNG="$(file "$APPSPATH"/*/icons/* | grep -i '.png' | awk -F":" '{print $1}' | grep -vi .png)"
SVG="$(file "$APPSPATH"/*/icons/* | grep -i '.svg' | awk -F":" '{print $1}' | grep -vi .svg)"
for file in $PNG; do
ln -s "$file" "${file}".png
done
for file in $SVG; do
ln -s "$file" "${file}".svg
done
mkdir -p "$DATADIR"/icons/hicolor/scalable/apps
find "$DATADIR"/icons/hicolor/scalable/apps -xtype l -exec rm {} \;
ln -s "$APPSPATH"/*/icons/*.* "$DATADIR"/icons/hicolor/scalable/apps
}

function _icon_theme() {
Expand All @@ -118,7 +126,7 @@ function _icon_theme() {
else
sed -i "s#Icon=$APPSPATH/$arg/icons/#Icon=#g" "$DATADIR"/applications/"$arg"*AM.desktop 2>/dev/null
fi
_icon_theme_export_to_datadir
_icon_theme_export_to_datadir 2>/dev/null
}

# LAUNCHER
Expand Down Expand Up @@ -306,6 +314,7 @@ function _remove() {
sleep 0.1
echo -e " \"${Green}$2\033[0m\" has been removed!"
fi
[ -d "$DATADIR"/icons/hicolor/scalable/apps ] && find "$DATADIR"/icons/hicolor/scalable/apps -xtype l -exec rm {} \;
}

function _hard_remove() {
Expand All @@ -318,6 +327,7 @@ function _hard_remove() {
$SUDOCMD "$APPSPATH"/"$arg"/remove || return 1
sleep 0.1
echo -e " \"${Green}$2\033[0m\" has been removed!"
[ -d "$DATADIR"/icons/hicolor/scalable/apps ] && find "$DATADIR"/icons/hicolor/scalable/apps -xtype l -exec rm {} \;
}

###########################################################################
Expand Down

0 comments on commit d148f58

Please sign in to comment.