How to automatically run program on GNOME startup
You can configure applications or scripts to execute when logging in to your GNOME session. If you require your application or script to launch regardless of your desktop environment or even before you're logged in, you can use other methods such as systemd or crontab.
This method works for any Linux distributions as long as GNOME is the user's desktop environment. Some of the Linux distributions with GNOME as the default desktop environment are Ubuntu, and CentOS / Red Hat.
This method creates an autostart config file that GNOME uses to launch your application or script. It does not require the installation of third-party tools such as GNOME Tweaks.
Steps to configure autostart program for GNOME:
-
Open GNOME Shell Activities.
-
Search for and click on Startup Application Preferences.
-
Click on the checkbox to uncheck or click on the Remove button to disable application from starting during GNOME startup.
-
Click Add button to start adding program to run when GNOME starts.
-
Enter a name and comment to identify the startup task.
-
Manually enter the path to application binary or script along with necessary arguments, or click on the Browse button to locate the application or script.
Make sure the user has execute permission on the script or application.
Related: How to change file and folder permissions in Linux -
Click the Add button to finish adding the startup entry to GNOME.
-
Click on the Close button if you're not adding other startup entries.
-
Check the generated autostart file to confirm.