Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add .png or .svg symlinks to icons management.am #925

Merged
merged 1 commit into from
Sep 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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