diff --git a/Makefile b/Makefile
index 49ebeaf..2d84e00 100644
--- a/Makefile
+++ b/Makefile
@@ -5,6 +5,7 @@ export PREFIX = /usr/local
export EMMENTAL_LIB = ${PREFIX}/lib/emmental
export EMMENTAL_BIN = ${PREFIX}/bin
export EMMENTAL_SHARE = ${PREFIX}/share
+export EMMENTAL_DESKTOP = ${EMMENTAL_SHARE}/applications/com.nowheycreamery.emmental.desktop
all: emmental.gresource mpris2 flake8
@@ -38,16 +39,35 @@ emmental.gresource.xml:
emmental.gresource: emmental.gresource.xml
glib-compile-resources emmental.gresource.xml
+.PHONY: install.app
+install.app:
+ find ./emmental -type f -not -path "*/__pycache__/*" \
+ -exec install -v -C -D -m 755 "{}" "$(EMMENTAL_LIB)/{}" \;
+ install -C -v -m 644 emmental.py $(EMMENTAL_LIB)/emmental.py
+
+.PHONY: install.icons
+install.icons:
+ install -C -v -m 644 emmental.gresource $(EMMENTAL_LIB)/emmental.gresource
+ install -C -v -m 644 icons/scalable/apps/emmental.svg $(EMMENTAL_LIB)/emmental.svg
+
+.PHONY: install.desktop
+install.desktop:
+ desktop-file-install --set-key=Exec --set-value $(EMMENTAL_BIN)/emmental \
+ --set-key=Icon --set-value=$(EMMENTAL_LIB)/emmental.svg \
+ --rebuild-mime-info-cache \
+ --dir=$(EMMENTAL_SHARE)/applications emmental.desktop
+
.PHONY: install
-install: emmental.gresource
- exec tools/install.sh
+install: emmental.gresource mpris2 install.app install.icons install.desktop
+ mkdir -p $(EMMENTAL_BIN)
+ echo -e "#!/bin/bash\npython -O $(EMMENTAL_LIB)/emmental.py \$$*" > $(EMMENTAL_BIN)/emmental
+ chmod 655 $(EMMENTAL_BIN)/emmental
.PHONY: uninstall
uninstall:
- rm -fv ${EMMENTAL_BIN}/emmental
- rm -rfv ${EMMENTAL_LIB}
- rm -fv ${EMMENTAL_SHARE}/icons/hicolor/scalable/apps/emmental*.svg
- rm -fv ${EMMENTAL_SHARE}/applications/emmental.desktop
+ rm -f ${PREFIX}/share/applications/com.nowheycreamery.emmental.desktop
+ rm -f ${PREFIX}/bin/emmental
+ rm -rf ${PREFIX}/lib/emmental/
.PHONY: pkgbuild
pkgbuild:
diff --git a/data/emmental b/data/emmental
deleted file mode 100644
index 55ee16c..0000000
--- a/data/emmental
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/bash
-
-python -O {EMMENTAL_LIB}/emmental.py $*
diff --git a/data/emmental.desktop b/data/emmental.desktop
deleted file mode 100644
index ca33e99..0000000
--- a/data/emmental.desktop
+++ /dev/null
@@ -1,10 +0,0 @@
-[Desktop Entry]
-Type=Application
-Version=1.5
-Name=Emmental
-GenericName=Music Player
-Comment=Listen to your music
-Exec={EMMENTAL_BIN}/emmental
-Icon=emmental
-Terminal=false
-Categories=AudioVideo;Audio;
diff --git a/data/emmental.png b/data/emmental.png
deleted file mode 100644
index de79b34..0000000
Binary files a/data/emmental.png and /dev/null differ
diff --git a/data/hicolor/scalable/apps/emmental-favorites.svg b/data/hicolor/scalable/apps/emmental-favorites.svg
deleted file mode 100644
index 1ad0bdf..0000000
--- a/data/hicolor/scalable/apps/emmental-favorites.svg
+++ /dev/null
@@ -1,60 +0,0 @@
-
-
-
-
diff --git a/data/hicolor/scalable/apps/emmental.svg b/data/hicolor/scalable/apps/emmental.svg
deleted file mode 100644
index 5b25897..0000000
--- a/data/hicolor/scalable/apps/emmental.svg
+++ /dev/null
@@ -1,118 +0,0 @@
-
-
-
-
diff --git a/emmental.desktop b/emmental.desktop
new file mode 100644
index 0000000..eb2e421
--- /dev/null
+++ b/emmental.desktop
@@ -0,0 +1,11 @@
+[Desktop Entry]
+Type=Application
+Version=1.5
+Name=Emmental
+GenericName=Music Player
+Comment=The Cheesy Music Player
+DBusActivatable=false
+Terminal=false
+MimeType=application/musepack;application/ogg;application/x-ape;application/x-flac;application/x-id3;application/x-musepack;application/x-ogg;application/x-ogm-audio;audio/aac;audio/ape;audio/flac;audio/mp;audio/mp3;audio/mp4;audio/mpc;audio/mpeg;audio/mpeg3;audio/mpegurl;audio/musepack;audio/ogg;audio/vnd.rn-realaudio;audio/vorbis;audio/x-ape;audio/x-flac;audio/x-it;audio/x-m4a;audio/x-mod;audio/x-mp;audio/x-mp3;audio/x-mpc;audio/x-mpeg;audio/x-mpeg-3;audio/x-mpegurl;audio/x-ms-wma;audio/x-musepack;audio/x-ogg;audio/x-oggflac;audio/x-pn-realaudio;audio/x-s3m;audio/x-scpls;audio/x-speex;audio/x-stm;audio/x-vorbis;audio/x-vorbis+ogg;audio/x-wav;audio/x-xm;
+Categories=AudioVideo;Audio;Music;Player;GTK;GNOME;
+SingleMainWindow=true
diff --git a/tools/install.sh b/tools/install.sh
deleted file mode 100755
index d71d83b..0000000
--- a/tools/install.sh
+++ /dev/null
@@ -1,44 +0,0 @@
-#!/bin/bash
-
-function install_file()
-{
- install -p -v $* | grep -v "^removed"
-}
-
-
-#
-# Install source files
-#
-install -d -v -m 755 $EMMENTAL_LIB
-install_file -m 644 emmental.py $EMMENTAL_LIB/emmental.py
-
-for dir in `tools/list_install_dirs.py`; do
- install -d -v -m 755 $EMMENTAL_LIB/$dir
-
- files=`find $dir -not -name "test_*.py" -name "*.py"`
- install_file -m 644 $files $EMMENTAL_LIB/$dir/
-done
-
-
-#
-# Install icons
-#
-EMMENTAL_ICONS=$EMMENTAL_SHARE/icons/hicolor/scalable/apps
-install -d -v -m 755 $EMMENTAL_ICONS
-install_file -m 644 data/hicolor/scalable/apps/*.svg $EMMENTAL_ICONS/
-
-
-#
-# Install and adjust executable
-#
-install -d -v -m 755 $EMMENTAL_BIN
-install_file -m 655 data/emmental $EMMENTAL_BIN/emmental
-sed -i "s|{EMMENTAL_LIB}|$EMMENTAL_LIB|" $EMMENTAL_BIN/emmental
-
-
-#
-# Install and adjust .desktop file
-#
-install -d -v -m 755 $EMMENTAL_SHARE/applications
-install_file -m 644 data/emmental.desktop $EMMENTAL_SHARE/applications
-sed -i "s|{EMMENTAL_BIN}|$EMMENTAL_BIN|" $EMMENTAL_SHARE/applications/emmental.desktop
diff --git a/tools/list_install_dirs.py b/tools/list_install_dirs.py
deleted file mode 100755
index f9dcec7..0000000
--- a/tools/list_install_dirs.py
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/usr/bin/python
-import pathlib
-
-exclude = [ ".git", "data", "tools" ]
-
-for p in pathlib.Path(".").iterdir():
- if p.is_dir() and not str(p) in exclude:
- print(p)