diff --git a/EDMarketConnector.py b/EDMarketConnector.py index 13d1bd44..fe31304d 100755 --- a/EDMarketConnector.py +++ b/EDMarketConnector.py @@ -509,7 +509,7 @@ class AppWindow(object): else: self.w.tk.call('wm', 'iconphoto', self.w, '-default', - tk.PhotoImage(file=join(config.respath_path, 'EDMarketConnector.png'))) + tk.PhotoImage(file=join(config.respath_path, 'io.edcd.EDMarketConnector.png'))) # TODO: Export to files and merge from them in future ? self.theme_icon = tk.PhotoImage( diff --git a/io.edcd.EDMarketConnector.desktop b/io.edcd.EDMarketConnector.desktop new file mode 100644 index 00000000..472c7add --- /dev/null +++ b/io.edcd.EDMarketConnector.desktop @@ -0,0 +1,13 @@ +#!/usr/bin/env xdg-open +[Desktop Entry] +Type=Application +# Ref: +Version=1.5 +Name=E:D Market Connector +Comment=Utilise Elite Dangerous Journal and CAPI data +Icon=io.edcd.EDMarketConnector +Categories=Game; +Keywords=Elite;Dangerous;EDDN;EDSM;EDDB;Inara;Spansh; +Exec=edmarketconnector +Terminal=false +SingleMainWindow=true diff --git a/EDMarketConnector.png b/io.edcd.EDMarketConnector.png similarity index 100% rename from EDMarketConnector.png rename to io.edcd.EDMarketConnector.png diff --git a/scripts/edmarketconnector.sh b/scripts/edmarketconnector.sh new file mode 100644 index 00000000..3505184a --- /dev/null +++ b/scripts/edmarketconnector.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +set -e + +# NB: EDMC_PATH is replaced with the correct value by the +# scripts/linux-setup.sh script. So, no, there's no missing '$' here. +cd EDMC_PATH +python3 EDMarketConnector.py diff --git a/scripts/linux-setup.sh b/scripts/linux-setup.sh new file mode 100644 index 00000000..fb9ee393 --- /dev/null +++ b/scripts/linux-setup.sh @@ -0,0 +1,74 @@ +#!/usr/bin/env bash +# +# Set up necessary support files to make running EDMarketConnect streamlined +# on Linux. +# + +########################################################################### +# Shell script launcher +# +# This needs to be in an appropriate component of $PATH so that the +# reference in the .desktop file will work. +########################################################################### +####################################################### +# Determine where edmarketconnector.sh needs to go +####################################################### +# Really we need this to be "${HOME}/bin", so check that is in $PATH +if [[ ":$PATH:" != *":$HOME/bin:"* ]]; +then + echo "You need to have '${HOME}/bin' in your PATH" + echo "Please fix this (might require relogging) and try again" + exit 1 +fi +EDMC_BIN_PATH="${HOME}/bin" +if [ ! -d "${EDMC_BIN_PATH}" ]; +then + echo "'${EDMC_BIN_PATH}' must exist and be a directory!" + exit 2 +fi +####################################################### + +####################################################### +# Determine where the source is located +####################################################### +# We know where this script is situated within an unzip/git clone of +# the source code, so set EDMC_PATH based on that. +# This is in `scripts/` of the source, so one directory up +EDMC_PATH="$(dirname $0)/.." +# And we need the *full* absolute path +EDMC_PATH="$(realpath ${EDMC_PATH})" +echo "EDMC_PATH = ${EDMC_PATH}" +####################################################### + + +####################################################### +# Copy an edited version of edmarketconnector.sh into place +####################################################### +echo "Copying launcher shell script into place..." +sed -e "s#EDMC_PATH#${EDMC_PATH}#g;" \ + < "${EDMC_PATH}/scripts/edmarketconnector.sh" \ + > "${EDMC_BIN_PATH}/edmarketconnector" +####################################################### +########################################################################### + +########################################################################### +# Desktop file +# +# This needs to be in a path where any XDG-compliant environment will be +# able to find it. +########################################################################### +echo "Copying .desktop file into place ..." +install -d -m700 "${HOME}/.local/share/applications" +install -t "${HOME}/.local/share/applications" "${EDMC_PATH}/io.edcd.EDMarketConnector.desktop" +########################################################################### + +########################################################################### +# Icon file +# +# This needs to be in a path where any XDG-compliant environment will be +# able to find it. +########################################################################### +echo "Copying icon file into place..." +install -d -m700 "${HOME}/.local/share/icons/hicolor/512x512/apps" +install -t "${HOME}/.local/share/icons/hicolor/512x512/apps" "${EDMC_PATH}/io.edcd.EDMarketConnector.png" +###########################################################################