paperlib icon indicating copy to clipboard operation
paperlib copied to clipboard

[Feature Request] Linux Desktop Entry

Open lvjonok opened this issue 1 year ago • 7 comments

I wanted to highlight that running an application from the terminal as ./Paperlib.AppImage might not be as convenient for users. To streamline the process, I have created a simple shell script to add a desktop entry. This script can be particularly useful for making the application easily accessible from the desktop environment.

Script Details:

#!/bin/bash

# Check if the AppImage path is provided as an argument
if [ -z "$1" ]; then
    echo "Usage: $0 /path/to/your/AppImage"
    exit 1
fi

# Define the path to the AppImage
APPIMAGE_PATH="$1"

# Get the base name of the AppImage to use for the desktop entry name and icon
APPIMAGE_NAME=$(basename "$APPIMAGE_PATH" .AppImage)

# Define the desktop entry path
DESKTOP_ENTRY_PATH="$HOME/.local/share/applications/$APPIMAGE_NAME.desktop"

# Create the desktop entry file
cat << EOF > $DESKTOP_ENTRY_PATH
[Desktop Entry]
Version=1.0
Type=Application
Name=$APPIMAGE_NAME
Exec=$APPIMAGE_PATH
Icon=$APPIMAGE_PATH
Comment=$APPIMAGE_NAME AppImage
Categories=Utility;
Terminal=false
EOF

# Make the desktop entry executable
chmod +x $DESKTOP_ENTRY_PATH

echo "Desktop entry created at $DESKTOP_ENTRY_PATH"

Usage:

You can use this script as follows:

./create_paperlib_entry.sh /path/to/your/Paperlib.AppImage

This should fit well into the installation procedure for Linux.

lvjonok avatar Jul 22 '24 06:07 lvjonok

Hi thanks for your script.

it would be nice to put it on our website. Are you happy with it? (I will mention you as the author of the script on our webpage.)

GeoffreyChen777 avatar Jul 22 '24 08:07 GeoffreyChen777

It worked well, the improvements might be to add Icon to the app.

lvjonok avatar Jul 22 '24 08:07 lvjonok

I’m not familiar with the Desktop Entry, what is the image format of the icon? How to use it in the script?

GeoffreyChen777 avatar Jul 22 '24 08:07 GeoffreyChen777

I did a quick search: https://github.com/supermerill/SuperSlicer/issues/2594#issuecomment-1083656428

Looks like paperlib.png should be placed in usr/share/icons of AppImage build to work out of the box with my shell script.

lvjonok avatar Jul 22 '24 09:07 lvjonok

So add this should be ok?

curl -o /usr/share/icons/paperlib.png https://raw.githubusercontent.com/Future-Scholars/paperlib/main/assets/icon.png

GeoffreyChen777 avatar Jul 22 '24 09:07 GeoffreyChen777

I believe it should be solved on the level of AppImage build process. You can unzip the AppImage with ./Paperlib.AppImage --appimage-extract. And inside this fs at squashfs-root/usr/share/icons the desired icon should be located.

lvjonok avatar Jul 22 '24 09:07 lvjonok

OK, I will try this with the next release. Thanks

GeoffreyChen777 avatar Jul 22 '24 09:07 GeoffreyChen777