From 8229616ad7db2f314b3afc82271979dea3ab88bf Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Thu, 30 Jun 2022 14:56:16 +0300 Subject: [PATCH] tweaking the desktop file... Signed-off-by: Alex A. Naanou --- Viewer/Makefile | 46 ++++++++++++++++++++++++------------ Viewer/templates/App.desktop | 4 ++-- 2 files changed, 33 insertions(+), 17 deletions(-) diff --git a/Viewer/Makefile b/Viewer/Makefile index cfea9128..13e3cf46 100644 --- a/Viewer/Makefile +++ b/Viewer/Makefile @@ -168,20 +168,34 @@ SHELL := bash APP_NAME ?= ImageGrid.Viewer +DEVEL_PATH := $(shell pwd) -# XXX move these to a better spot... -# XXX install path should depend on type of install... -# - dev - run from repo dir -# - user - install in user dir -# - system - global install +# install mode... +# XXX revise... INSTALL_PATH ?= +INSTALL ?= dev +ifeq ($(INSTALL_PATH),) + ifeq ($(INSTALL),dev) + INSTALL_PATH := $(DEVEL_PATH) + DESKTOP_PATH ?= $(HOME)/.local/share/applications/ + endif + ifeq ($(INSTALL),user) + # XXX + INSTALL_PATH := + DESKTOP_PATH ?= $(HOME)/.local/share/applications/ + endif + ifeq ($(INSTALL),system) + # XXX + INSTALL_PATH := + DESKTOP_PATH ?= /usr/local/share/applications/ + endif +endif + APP_PATH ?= ig ICON_PATH ?= -# XXX not sure about these yet... -INSTALL_PATH ?= $(shell pwd) -APP_LAUNCHER ?= $(INSTALL_PATH)/ig.js gui +APP_LAUNCHER := ig.js gui VERSION_FALLBACK ?= 4.0.0a # NOTE: we are not using './ig --version 2> /dev/null' because it will @@ -235,9 +249,6 @@ ELECTRON_DOWNOAD_URL ?= \ ELECTRON_DIST ?= electron-$(ELECTRON_VERSION)-$(TARGET_OS)-$(ARCH).zip -APP_DIR ?= $(HOME)/.local/share/applications/ - - BUILD_MODE ?= in-place @@ -653,13 +664,17 @@ electron-run: dev ##---------------------------------------------------- Open Desktop --- +.PHONY: desktop-file +desktop-file: $(APP_NAME).desktop + .PHONY: desktop -desktop: dev $(APP_NAME).desktop - desktop-file-install --dir="$(APP_DIR)" $(APP_NAME).desktop +desktop: dev desktop-file + desktop-file-install --dir="$(DESKTOP_PATH)" $(APP_NAME).desktop + update-desktop-database "$(DESKTOP_PATH)" .PHONY: desktop-remove desktop-remove: - rm -f $(APP_DIR)/$(APP_NAME).desktop + rm -f $(DESKTOP_PATH)/$(APP_NAME).desktop @@ -719,7 +734,8 @@ $(BUILD_INFO): $(CSS_FILES) $(NODE_DIR) $(PROJECT_FILES) \ # XXX get this from the install path... $(APP_NAME).desktop: templates/App.desktop cat $< \ - | sed 's#\$$LAUNCHER#$(APP_LAUNCHER)#' \ + | sed 's#\$$LAUNCHER#$(INSTALL_PATH)/$(APP_LAUNCHER)#' \ + | sed 's#\$$ICON#$(ICON_PATH)#' \ > $@ diff --git a/Viewer/templates/App.desktop b/Viewer/templates/App.desktop index 6342e66a..14d9eef6 100644 --- a/Viewer/templates/App.desktop +++ b/Viewer/templates/App.desktop @@ -1,9 +1,9 @@ [Desktop Entry] Name=ImageGrid.Viewer Comment=Image sorting and editing -Categories=Graphics;Database;Viewer;Photography; +Categories=Photography;Graphics;Database;Viewer; Exec=$LAUNCHER -Icon= +Icon=$ICON Terminal=false Type=Application StartupNotify=true