Add linux app to ubuntu

 When you run flutter build linux, Flutter generates the build files inside the build/linux directory of your project.

Here’s the typical directory structure:

reminder-app/

├── build/

│   ├── linux/

│   │   ├── x64/

│   │   │   ├── release/   <-- This contains the built binary and other necessary files

│   │   ├── debug/

│   │   ├── intermediate/

│   ├── ...

├── linux/   <-- Contains CMake-related build configuration

├── lib/

├── ...



Install System-Wide (Optional)

1️⃣ Create the Directory in /opt/

Run the following command to create the directory for your app:

bash
sudo mkdir -p /opt/reminder-app

2️⃣ Copy the Files Again

Now, copy all the files from the bundle folder to /opt/reminder-app/:

bash
sudo cp -r build/linux/x64/release/bundle/* /opt/reminder-app/

3️⃣ Set the LD_LIBRARY_PATH

Create a launcher script to set the LD_LIBRARY_PATH and run the application. Use this command to open the script for editing:

bash
sudo nano /usr/local/bin/reminder-app

Add the following content to the script:

bash
#!/bin/bash export LD_LIBRARY_PATH=/opt/reminder-app:$LD_LIBRARY_PATH /opt/reminder-app/reminder-app

4️⃣ Make the Script Executable

Make sure the script is executable:

bash
sudo chmod +x /usr/local/bin/reminder-app

5️⃣ Run the Application

Now, try running your app again:

bash
reminder-app

Here are the steps to add your Flutter app as a desktop app:

1️⃣ Create a .desktop File

  1. Create a .desktop file for your application in the ~/.local/share/applications/ directory (this is where local desktop entries are stored).

bash
nano ~/.local/share/applications/reminder-app.desktop
  1. Add the following content to the .desktop file, replacing the paths accordingly:

ini
[Desktop Entry] Version=1.0 Name=Reminder App Comment=Your Flutter-based reminder app Exec=/opt/reminder-app/reminder-app Icon=/opt/reminder-app/icon.png Terminal=false Type=Application Categories=Utility;
  • Name: The name of your app (what will be displayed in the menu).

  • Exec: The full path to the executable for your app.

  • Icon: Path to your app's icon (optional, but it's recommended to add one).

  • Terminal: Whether the app should run in a terminal window (false for graphical apps).

  • Type: Type of entry, which is Application for desktop apps.

  • Categories: Categorize your app (e.g., Utility, Development, etc.).

2️⃣ Add an Icon (Optional)

If you want to add an icon for your app:

  • Place your app's icon (e.g., icon.png) in the /opt/reminder-app/ directory (or any other folder).

  • Update the .desktop file's Icon path to reflect the correct location of your icon.

3️⃣ Make the .desktop File Executable

Make the .desktop file executable by running:

bash
chmod +x ~/.local/share/applications/reminder-app.desktop

4️⃣ Refresh the Desktop Environment

In some cases, you may need to refresh your desktop environment for the new app to appear in your menu. You can either log out and log back in, or run the following to update your application list:

bash
update-desktop-database ~/.local/share/applications/

5️⃣ Launch the App from the Menu

Now, your Flutter app should appear in your desktop application menu (for example, in Applications or All Programs depending on your desktop environment). You can search for "Reminder App" and launch it from there.

Comments

Popular posts from this blog

Top Laravel Security Best Practices: How to Secure Your Web Application 🚀

useCallback hook in React

Passing array from child to parent component