Ubuntu – Running script at startup when using i3wm

i3-wmstartupstartup-applications

I can't for the life of me get scripts to run at startup.
I have a script called "startup.sh" in my home directory. I have tried (at least) the following ways to get it to run at startup:

  • Adding it to .profile
  • Adding it to .bashrc
  • Adding a run command to i3's config in /etc (I use i3)
  • Adding it to Xsession and xinitrc (I think, will retry)
  • Adding it to /etc/rc.local
  • Adding it to init.d

The only thing that worked was Unity's Startup Applications menu, which doesn't work with i3.

Any ideas?

Best Answer

Run sudo command (just in case) without asking for password command line:

echo YOUR_PASSWORD | sudo -S YOUR_COMMAND

Put command lines in /etc/rc.local:

sudo -H gedit /etc/rc.local

Imformation sources:

Stack Overflow: How to Run a Shell Script at Startup

Related Question