Hello developer, today i will see how to create an appimage for your linux desktop application.
Motivation
Probably, if you are looking for this article, you should think like me “I hate snaps” or “I hate snaps even more” or just want easier portability for your desktop application. In this article, I will demonstrate how to port a desktop flutter application to an AppImage.
First step
Create your application
flutter create --platforms=linux appimage_examplecd appimage_example
Then build the project
flutter build linux --release
Next step
Download the appimagetool
it will create the final app.
And change the file mode.
chmod +x appimagetool-x86_64.AppImage
Final steps
You’ll need copy the bundle
folder to a new one called ${APP_NAME}.AppDir
For example:
cp -r build/linux/release/bundle/ AppImageExample.AppDir
Find a cute icon for your app :3
then copy it to AppDir
folder.
cp appimage_example.png AppImageExample.AppDir/
Create a AppRun
file
this file is used to statup the application.
#!/bin/shcd "$(dirname "$0")"
exec ./appimage_example
change the file mode
chmod +x AppRun
then copy it to AppDir
folder.
cp AppRun AppImageExample.AppDir/
Create a .desktop
file
If you don’t know what is a .desktop file see this.
[Desktop Entry]
Version=1.0
Type=Application
Terminal=false
Name=AppImage Example
Exec=appimage_example %u
Icon=appimage_example
Categories=Utility;
then copy to AppDir
folder
cp AppImageExample.desktop AppImageExample.AppDir/
The AppDir
folder needs to look like this
Build your .AppImage app
Oh yeah the best part B)
Run
appimagetool-x86_64.AppImage AppImageExample.AppDir/ appimage_example.AppImage
You can name the final file however you want, in this example I called it appimage_example.AppImage
And run your applicaton
I hope you enjoyed and been able to do in your application, until the next time❤
References
https://www.booleanworld.com/creating-linux-apps-run-anywhere-appimage/