#!/usr/bin/env sh # Adds Tidewall from this folder to your desktop's application menu, for you alone: # a desktop entry in ~/.local/share/applications and the icon in # ~/.local/share/icons. Nothing outside your home is touched. # # ./install-desktop-entry.sh add it (again, if the folder moved) # ./install-desktop-entry.sh --remove take it away set -eu here="$(dirname "$(readlink -f "$0")")" data="${XDG_DATA_HOME:-$HOME/.local/share}" entry="$data/applications/tidewall.desktop" icon="$data/icons/hicolor/256x256/apps/tidewall.png" if [ "${1:-}" = "--remove" ]; then rm -f "$entry" "$icon" echo "Removed the Tidewall menu entry." exit 0 fi if [ "$#" -gt 0 ]; then echo "usage: $0 [--remove]" >&2 exit 2 fi case "$here" in *'"'* | *'\'* | *'`'* | *'$'* | *'%'*) echo "This folder's path has a character a desktop entry can't hold; move it and try again." >&2 exit 1 ;; esac mkdir -p "$(dirname "$entry")" "$(dirname "$icon")" cp "$here/tidewall.png" "$icon" cat >"$entry" <