Closed bbatsov closed 2 months ago
This do the job for me:
[Desktop Entry]
Type=Application
Name=Portfolio Performance
Exec=/path/to/PortfolioPerformance/PortfolioPerformance
Icon=/path/to/PortfolioPerformance/icon.xpm
Categories=Application;
StartupWMClass=Portfolio Performance
little script to generate the desktop file for a GNU/Linux with Debian-flavor, move it to the destination and with the option to remove the file as well.
icon.xpm
), make it executable${HOME}/.local/share/applications/
respectively /usr/share/applications/portfolio.desktop
and the icon in your launcher/menu $ ./register-app.sh
$ ./register-app.sh global
$ ./register-app.sh remove
Not all dependencies are checked. I guess some more things might be added/changed, feel free.
register-app.sh
gdir="/usr/share/applications/"
ddir=$(echo "${HOME}/.local/share/applications/")
fn="portfolio.desktop"
uname -a|grep -i linux >/dev/null || { echo "not a Linux, better verify the script manually."; exit 1; }
test ! -d "${ddir}" && {
echo "directory not found: ${ddir} ."
test ! -d "${gdir}" && {
echo "global directory not found either: ${gdir} ."
exit 1
} || {
echo "global directory found, changing destination directory to ${gdir} ."
ddir="${gdir}"
test "${1}" = "global" && shift
}
}
#~ while $# -gt 1; do
case ${1} in
global)
test ! -d "${gdir}" && { echo "local directory not found ${ldir} ."; exit 1; }
echo "changing destination directory to ${gdir} ."
ddir="${gdir}"
;;
remove)
test -f "${ddir}${fn}" && { echo "removing local desktop file."; sudo rm "${ddir}${fn}" ; } || { echo "local desktop file not found."; }
test -f "${gdir}${fn}" && { echo "removing global desktop file."; sudo rm "${gdir}${fn}" ; } || { echo "global desktop file not found."; }
test -f ./${fn} && { sudo rm ./${fn} ; }
exit 0
;;
#~ h)
#~ help)
*)
esac
#~ shift
#~ done
path=$(pwd)
icon=icon.xpm
test -f ${icon} && echo "icon file found." || { echo "icon file not found … this might hint you placed the executable in the wrong directory."; exit 1; }
test -f ${ddir}${fn} && { echo "desktop file already installed." ; exit 1; }
test -f ${fn} && echo "file already exists " || {
echo "creating desktop file …"
cat >${fn} <<EOF
[Desktop Entry]
Encoding=UTF-8
Version=1.0
Type=Application
Terminal=false
StartupNotify=false
Exec="${path}/PortfolioPerformance"
Name=Portfolio Performance
GenericName=Personal finance
GenericName[de]=Persönliche Finanzen
Comment=Track your portfolio performance (finance)
Comment[de]=Portfolio verwalten und darstellen
Keywords=money;finances;stocks;shares;coin
Categories=Office;Finance;
Icon=${path}/${icon}
EOF
sudo chmod 644 ./${fn}
sudo chown root:root ./${fn}
echo "installing desktop file …"
sudo cp ./${fn} ${ddir}
}
Maybe someone can implement sth. like this in Java and add an option for it in the application itself, possibly also for other OSes. A suitable command line option could be --register-app
as it is available for e.g. the tor browser bundle.
I guess that's best illustrated with a screenshot of Ubuntu's app dock:
That iconless item is Portfolio Performance. I'm assuming that's because it doesn't ship a
.desktop
file. E.g. IB's TraderWorkstation (another Java app) has this fileTrader Workstation.desktop
:I assume Portfolio Performance needs something similar.
Desktop (please complete the following information):