Stirling-PDF icon indicating copy to clipboard operation
Stirling-PDF copied to clipboard

Creating a appmenu shortcut with unix local installation

Open brnakblt opened this issue 1 year ago • 3 comments

Semicolons prevent the .desktop file from being displayed in the appmenu. When I edit the semicolons with kwrite from /usr/share/applications/stirling-pdf.desktop , the appmenu shortcut is displayed but does not work when I click on it.

location=$(pwd)/gradlew image=$(pwd)/docs/stirling-transparent.svg

cat > ~/.local/share/applications/Stirling-PDF.desktop <<EOF [Desktop Entry] Name=Stirling PDF; GenericName=Launch StirlingPDF and open its WebGUI; Category=Office; Exec=xdg-open http://localhost:8080 && nohup $location bootRun &; Icon=$image; Keywords=pdf; Type=Application; NoDisplay=false; Terminal=true; EOF

brnakblt avatar Oct 23 '24 17:10 brnakblt

does not work when I click on it

Can you expand on this? Any error messages?

Frooodle avatar Oct 23 '24 17:10 Frooodle

I deleted the semicolons from the code to make the shortcut showing up in the appmenu (thats solves the creating a application menu shortcut) but when i click on it to launch the tool it shows a little terminal icon jumping near the cursor and nothing happens. I checked if the terminal running in the background and it wasn't there. Btw there was no browser launch when I'm running the app manually via terminal. I was copy pasting to the browser. Sorry there wasn't any error messages. Let me check on a fresh fedora install. I will be back.

brnakblt avatar Oct 23 '24 18:10 brnakblt

I ran into the same issue. Although it is not elegant, I have a workaround solution.

I created a shell script which is called by the .desktop file.

#!/bin/bash

# stirling_pdf.sh

java -jar /opt/Stirling-PDF/Stirling-PDF-*.jar &
j=$!
sleep 10
firefox --new-window http://localhost:8080 &
sleep 2

while true; do
    if /usr/bin/pgrep firefox >/dev/null; then
        continue
    else
        kill -9 $j
        exit
    fi
done

Here is the modified .desktop file.

[Desktop Entry]
Name=Stirling PDF
GenericName=Launch StirlingPDF and open its WebGUI
Category=Office
Exec=/home/afy/.local/bin/stirling_pdf.sh
Icon=/home/afy/.git/Stirling-PDF/docs/stirling-transparent.svg
Keywords=pdf
Type=Application
Terminal=true

The shell script allows 10 seconds to allow Stirling-pdf to up before starting the web browser. When you kill the browser, stirling-pdf is also killed. However, if you have more than one browser instance open, Stirling will not close until you close all browser instances.

MrYsLab avatar Nov 29 '24 22:11 MrYsLab