1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-04-15 16:50:34 +03:00

Merge pull request #1800 from EDCD/enhancement/1041/desktop-file

.desktop: Add a file, and adjust icon filename to suit
This commit is contained in:
Athanasius 2023-01-11 18:09:55 +00:00 committed by GitHub
commit a37be45343
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 96 additions and 1 deletions

View File

@ -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(

View File

@ -0,0 +1,13 @@
#!/usr/bin/env xdg-open
[Desktop Entry]
Type=Application
# Ref: <https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-1.5.html>
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

View File

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 31 KiB

View File

@ -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

74
scripts/linux-setup.sh Normal file
View File

@ -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"
###########################################################################