Pages

Thursday, February 8, 2018

Run script at logon in any Linux with LXDE

Today I want to save you a lot of time with this shit. It's so simple when someone tells you.

- First, this works for running things at user logon, not at system startup. For the latter, use something like Cron and good luck with it.
- Second, this is user dependent. You'll have to do it for every user.
- Third, just in case you didn't read the damn title, this is for linux distributions with LXDE desktop only.

I start from the point where you have an script.sh ready and working, that being said, let's start:

1. Go to "YOUR_USERNAME/.config/autostart". These are hidden folders, so copy & paste the path into PCManFM or activate "Show hidden folders" to get to the place.

2. Create a new file called "YOUR_SCRIPT_NAME.desktop".

3. Put inside the following:
[Desktop Entry]
Name=YOUR_SCRIPT_NAME
Exec=PATH_TO_YOUR_SCRIPT
Terminal=false
Type=Application

Example for the lazy:

[Desktop Entry]
Name=FBI_hack
Exec=/james/my_folder/FBI_hack.sh
Terminal=false
Type=Application

4. Go to the start menu Preferences -> Desktop Session Settings. Check your script is listed and mark with a tick.

5. Last but not least, go to your script and make sure it has execution rights. For that, right click, Properties, Permissions tab, Execute -> Anyone.

That's all for today, with this it should run a few moments after the user logs in.
Tell me if it helped you.