Where to put .desktop file and icon

Aug 26, 2023
D

I am in the process of creating a flatpak package for my application and publishing it to flathub, but I am unsure where to put the .desktop file and the icon.

My github repository, that I am cloning to build the program, contains the .desktop file and the application’s icon is located in my github’s src/ directory. Will flatpak be able to find these itself, or do I need to upload these in the flathub PR, so that they are located in the root directory of my PR (next to the manifest)?

C

I use this commands in manifest:

  - name: tabela
    buildsystem: simple
    build-commands:
      - python -m pip install --no-deps --no-build-isolation --prefix=/app .
      - install -Dm644 data/eu.cichy1173.tabela.desktop -t /app/share/applications
      - install -Dm644 data/eu.cichy1173.tabela.metainfo.xml -t /app/share/metainfo
      - install -Dm644 data/icons/hicolor/apps/48x48/eu.cichy1173.tabela.png -t /app/share/icons/hicolor/48x48/apps
      - install -Dm644 data/icons/hicolor/apps/128x128/eu.cichy1173.tabela.png -t /app/share/icons/hicolor/128x128/apps

Command - python -m pip install --no-deps --no-build-isolation --prefix=/app . installs the app. Next four commands are for icons, .desktop and metainfo

D
Replying to #2

Ok so I understand it correct that I need to manually copy the .desktop, .metainfo and the icon to the proper locations, right?

C
Replying to #3

I am not a pro in Flatpak (I published only one app tabela | Flathub) but this commands work, so I think this files can be copied manually. Is it the only way? I think not, but you have to ask more experienced developers about that

D
Replying to #4

Ok thank you, I will go with your approach

D
Replying to #5

What exactly is python -m pip install --no-deps --no-build-isolation --prefix=/app . doing in your example?

C
Replying to #6

Installs the app using setup.py and setuptools

D
Replying to #7

I understand, so it moves your actual binary to the destination location, right?

Btw, you shared install -Dm644 data/eu.cichy1173.tabela.desktop -t /app/share/applications above. Where exactly is my current position at this step? Is it in the cloned git repository, or is it one directory up?

C
Replying to #8

root directory of the git repo. data is a subdirectory in this repo. You can check this here: cichy1173/tabela-flatpak: Repository for Flatpak version of tabela app - tabela-flatpak - Codeberg.org