Skip to content

Commit e080d3f

Browse files
authored
Refresh the flatpak documentation (#3356)
1 parent 7cfa92f commit e080d3f

File tree

1 file changed

+42
-16
lines changed

1 file changed

+42
-16
lines changed

src/content/docs/distribute/flatpak.mdx

Lines changed: 42 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -60,43 +60,69 @@ flatpak install flathub org.gnome.Platform//46 org.gnome.Sdk//46
6060

6161
**3. [Build the .deb of your tauri-app](https://v2.tauri.app/reference/config/#bundleconfig)**
6262

63-
**4. Create the manifest**
63+
**4. [Create an AppStream MetaInfo file](https://www.freedesktop.org/software/appstream/metainfocreator/#/guiapp)**
64+
65+
**5. Create the flatpak manifest**
6466

6567
```yaml
66-
id: org.your.id
68+
# flatpak-builder.yaml
69+
id: <identifier>
6770

6871
runtime: org.gnome.Platform
6972
runtime-version: '46'
7073
sdk: org.gnome.Sdk
7174

72-
command: tauri-app
75+
command: <main_binary_name>
7376
finish-args:
7477
- --socket=wayland # Permission needed to show the window
7578
- --socket=fallback-x11 # Permission needed to show the window
7679
- --device=dri # OpenGL, not necessary for all projects
7780
- --share=ipc
7881
- --talk-name=org.kde.StatusNotifierWatcher # Optional: needed only if your app uses the tray icon
7982
- --filesystem=xdg-run/tray-icon:create # Optional: needed only if your app uses the tray icon - see an alternative way below
83+
# - --env=WEBKIT_DISABLE_COMPOSITING_MODE=1 # Optional: may solve some issues with black webviews on Wayland
8084

8185
modules:
8286
- name: binary
8387
buildsystem: simple
88+
8489
sources:
90+
# A reference to the previously generated flatpak metainfo file
91+
- type: file
92+
path: flatpak.metainfo.xml
93+
# If you use GitHub releases, you can target an existing remote file
8594
- type: file
8695
url: https://github.com/your_username/your_repository/releases/download/v1.0.1/yourapp_1.0.1_amd64.deb
8796
sha256: 08305b5521e2cf0622e084f2b8f7f31f8a989fc7f407a7050fa3649facd61469 # This is required if you are using a remote source
88-
only-arches: [x86_64] #This source is only used on x86_64 Computers
89-
# This path points to the binary file which was created in the .deb bundle.
90-
# Tauri also creates a folder which corresponds to the content of the unpacked .deb.
97+
only-arches: [x86_64] # This source is only used on x86_64 Computers
98+
# You can also use a local file for testing
99+
# - type: file
100+
# path: yourapp_1.0.1_amd64.deb
91101
build-commands:
92-
- ar -x *.deb
93-
- tar -xf data.tar.gz
94-
- 'install -Dm755 usr/bin/tauri-app /app/bin/tauri-app'
95-
- install -Dm644 usr/share/applications/yourapp.desktop /app/share/applications/org.your.id.desktop
96-
- install -Dm644 usr/share/icons/hicolor/128x128/apps/yourapp.png /app/share/icons/hicolor/128x128/apps/org.your.id.png
97-
- install -Dm644 usr/share/icons/hicolor/32x32/apps/yourapp.png /app/share/icons/hicolor/32x32/apps/org.your.id.png
98-
- install -Dm644 usr/share/icons/hicolor/256x256@2/apps/yourapp.png /app/share/icons/hicolor/256x256@2/apps/org.your.id.png
99-
- install -Dm644 org.your.id.metainfo.xml /app/share/metainfo/org.your.id.rosary.metainfo.xml
102+
- set -e
103+
104+
# Extract the deb package
105+
- mkdir deb-extract
106+
- ar -x *.deb --output deb-extract
107+
- tar -C deb-extract -xf deb-extract/data.tar.gz
108+
109+
# Copy binary
110+
- 'install -Dm755 deb-extract/usr/bin/<executable_name> /app/bin/<executable_name>'
111+
112+
# If you bundle files with additional resources, you should copy them:
113+
- mkdir -p /app/lib/<product_name>
114+
- cp -r deb-extract/usr/lib/<product_name>/. /app/lib/<product_name>
115+
- find /app/lib/<product_name> -type f -exec chmod 644 {} \;
116+
117+
# Copy desktop file + ensure the right icon is set
118+
- sed -i 's/^Icon=.*/Icon=<identifier>/' deb-extract/usr/share/applications/<product_name>.desktop
119+
- install -Dm644 deb-extract/usr/share/applications/<product_name>.desktop /app/share/applications/<identifier>.desktop
120+
121+
# Copy icons
122+
- install -Dm644 deb-extract/usr/share/icons/hicolor/128x128/apps/<main_binary_name>.png /app/share/icons/hicolor/128x128/apps/<identifier>.png
123+
- install -Dm644 deb-extract/usr/share/icons/hicolor/32x32/apps/<main_binary_name>.png /app/share/icons/hicolor/32x32/apps/<identifier>.png
124+
- install -Dm644 deb-extract/usr/share/icons/hicolor/256x256@2/apps/<main_binary_name>.png /app/share/icons/hicolor/256x256@2/apps/<identifier>.png
125+
- install -Dm644 flatpak.metainfo.xml /app/share/metainfo/<identifier>.metainfo.xml
100126
```
101127
102128
The Gnome 46 runtime includes all dependencies of the standard Tauri app with their correct versions.
@@ -119,10 +145,10 @@ TrayIconBuilder::new()
119145
```shell
120146

121147
# Install the flatpak
122-
flatpak -y --user install <local repo name> <your flatpak id>
148+
flatpak-builder --force-clean --user --disable-cache --repo flatpak-repo flatpak flatpak-builder.yaml
123149

124150
# Run it
125-
flatpak run <your flatpak id>
151+
flatpak run <your flatpak id> # or via your desktop environment
126152

127153
# Update it
128154
flatpak -y --user update <your flatpak id>

0 commit comments

Comments
 (0)