Following the Slack Flatpak manifest as an example, I think I’ve gotten to a pretty good place with this. I copied the Mailspring .desktop
, appdata.xml
, and icon png
files to the root flatpak
directory I made, then changed the Flatpak yml
file to look like this:
app-id: com.getmailspring.Mailspring
runtime: org.freedesktop.Platform
sdk: org.freedesktop.Sdk
runtime-version: '20.08'
base: org.electronjs.Electron2.BaseApp
base-version: '20.08'
sdk-extensions:
- org.freedesktop.Sdk.Extension.node14
separate-locales: false
command: mailspring
finish-args:
- --share=ipc
- --socket=x11
- --socket=pulseaudio
- --share=network
- --talk-name=org.freedesktop.secrets
- --talk-name=org.freedesktop.Notifications
- --talk-name=org.freedesktop.Flatpak
- --system-talk-name=org.freedesktop.login1
- --talk-name=org.kde.StatusNotifierWatcher
- --talk-name=com.canonical.AppMenu.Registrar
# probably not necessary for system tray icon, at least in GNOME.
#- --own-name=org.kde.StatusNotifierItem-3-2
build-options:
append-path: /usr/lib/sdk/node14/bin
cflags: -O2 -g
cxxflags: -O2 -g
env:
NPM_CONFIG_LOGLEVEL: info
modules:
- shared-modules/libsecret/libsecret.json
- name: mailspring
buildsystem: simple
sources:
- type: extra-data
filename: mailspring.deb
only-arches:
- "x86_64"
url: https://github.com/Foundry376/Mailspring/releases/download/1.9.1/mailspring-1.9.1-amd64.deb
sha256: 99fa700d84691542c3f5387cb48e72a9be516166491daadb598a5f292dd0ea61
size: 87784166
- type: script
dest-filename: apply_extra
commands:
- ar x mailspring.deb
- rm -f mailspring.deb
- tar xf data.tar.xz
- rm -f control.tar.gz data.tar.xz debian-binary
- mv usr/* .
- chmod -R a-s,go+rX,go-w .
- rmdir usr
- type: file
path: mailspring-16x16.png
- type: file
path: mailspring-32x32.png
- type: file
path: mailspring-64x64.png
- type: file
path: mailspring-128x128.png
- type: file
path: mailspring-256x256.png
- type: file
path: mailspring.appdata.xml
- type: file
path: mailspring.desktop
# Wrapper to launch the app
- type: script
dest-filename: mailspring.sh
commands:
- exec env TMPDIR=$XDG_CACHE_HOME zypak-wrapper /app/extra/share/mailspring/mailspring -s $EXTRA_ARGS \"$@\"
build-commands:
- install apply_extra ${FLATPAK_DEST}/bin
- install mailspring.sh ${FLATPAK_DEST}/bin/mailspring
- install -Dm644 mailspring.appdata.xml ${FLATPAK_DEST}/share/appdata/${FLATPAK_ID}.appdata.xml
- install -Dm644 mailspring-16x16.png ${FLATPAK_DEST}/share/icons/hicolor/16x16/apps/${FLATPAK_ID}.png
- install -Dm644 mailspring-32x32.png ${FLATPAK_DEST}/share/icons/hicolor/32x32/apps/${FLATPAK_ID}.png
- install -Dm644 mailspring-64x64.png ${FLATPAK_DEST}/share/icons/hicolor/64x64/apps/${FLATPAK_ID}.png
- install -Dm644 mailspring-128x128.png ${FLATPAK_DEST}/share/icons/hicolor/128x128/apps/${FLATPAK_ID}.png
- install -Dm644 mailspring-256x256.png ${FLATPAK_DEST}/share/icons/hicolor/256x256/apps/${FLATPAK_ID}.png
- install -Dm644 mailspring.desktop ${FLATPAK_DEST}/share/applications/${FLATPAK_ID}.desktop
- desktop-file-edit --set-key="Icon" --set-value="com.getmailspring.Mailspring" ${FLATPAK_DEST}/share/applications/${FLATPAK_ID}.desktop
- desktop-file-edit --set-key="Exec" --set-value="mailspring %U" ${FLATPAK_DEST}/share/applications/${FLATPAK_ID}.desktop
- desktop-file-edit --set-key="StartupWMClass" --set-value="Mailspring" ${FLATPAK_DEST}/share/applications/${FLATPAK_ID}.desktop
- desktop-file-edit --set-key="X-Flatpak-RenamedFrom" --set-value="mailspring.desktop;" ${FLATPAK_DEST}/share/applications/${FLATPAK_ID}.desktop
- install -Dm755 /usr/bin/ar -t ${FLATPAK_DEST}/bin
- install -Dm755 /usr/lib/$(gcc -print-multiarch)/libbfd-*.so -t ${FLATPAK_DEST}/lib
Now my Linux distro picks up the .desktop
file and icons (including the tray icon) automatically.