Enable autostart of Applications
To automatically launch a application or script upon the login to your desktop session, you need to create a few files and put them into the right location.
In this tutorial, we will autoload a script located in ~/scripts/resolution.sh
.
Create a launcher file
Open up a text editor and put the following in:
[Desktop Entry]
Name=SetResolution
Description=Sets the Display resolution and scale
Type=Application
Exec=/sysroot/home/egon/scripts/resolution.sh
Icon=application-x-executable-symbolic
X-GNOME-Autostart-Enabled=true
X-GNOME-Autostart-Delay=0
Adopt the Exec path to reflect your actual home directory. The last two lines aren’t really necessary, but give you some kind of freedom to enable/disable autostart and optionally set a launch delay.
Save this file as ~/.config/autostart/SetResolution.desktop
Mark the launcher as trusted
Open up a Terminal and enter:
chmod 755 ~/.config/autostart/SetResolution.desktop
gio set ~/.config/autostart/SetResolution.desktop metadata::trusted yes