How to add a script in Startup Applications to all accounts?

Quick to answer questions about finding your way around Linux Mint as a new user.
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions use the other forums in the support section.
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
Dirkoir
Level 4
Level 4
Posts: 329
Joined: Wed Jul 30, 2014 12:43 pm

How to add a script in Startup Applications to all accounts?

Post by Dirkoir »

Hi, all:

I have a script ("xset s off") which prevents a laptop from freezing when going into (or coming out of?) idle induced suspend mode. When I added it to the "Startup Applications" it ended up installed only in my primary user account. How can I install it so it works in all user accounts on this machine -- other than manually installing the same script over and over in each account like a mule? (a mule with hands;-)

Thanks. :-)
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
______
Linux Mint 17 Cinnamon 64-bit | LM19 Cinnamon | LM20.1 MATE | LM20.3 Cinnamon
User avatar
Spearmint2
Level 16
Level 16
Posts: 6900
Joined: Sat May 04, 2013 1:41 pm
Location: Maryland, USA

Re: How to add a script in Startup Applications to all accou

Post by Spearmint2 »

I can guess. Put it in a root owned folder like bin, lib, or sbin and add it to the startup programs list.
All things go better with Mint. Mint julep, mint jelly, mint gum, candy mints, pillow mints, peppermint, chocolate mints, spearmint,....
Dirkoir
Level 4
Level 4
Posts: 329
Joined: Wed Jul 30, 2014 12:43 pm

Re: How to add a script in Startup Applications to all accou

Post by Dirkoir »

I think, noob that I am, I need a little elaboration. *sheepish grin*
______
Linux Mint 17 Cinnamon 64-bit | LM19 Cinnamon | LM20.1 MATE | LM20.3 Cinnamon
User avatar
Spearmint2
Level 16
Level 16
Posts: 6900
Joined: Sat May 04, 2013 1:41 pm
Location: Maryland, USA

Re: How to add a script in Startup Applications to all accou

Post by Spearmint2 »

If you have an executable file or script you want all to have access to, don't have it under /home folder.
All things go better with Mint. Mint julep, mint jelly, mint gum, candy mints, pillow mints, peppermint, chocolate mints, spearmint,....
eanfrid

Re: How to add a script in Startup Applications to all accou

Post by eanfrid »

Put it in the /etc/xdg/autostart folder. This is the system-wide equivalent to every user autostart folder (~/.config/autostart). The user autostart folder is the one populated with .desktop files when you add/edit something with "Preferences/Startup applications".
User avatar
Spearmint2
Level 16
Level 16
Posts: 6900
Joined: Sat May 04, 2013 1:41 pm
Location: Maryland, USA

Re: How to add a script in Startup Applications to all accou

Post by Spearmint2 »

somewhere near paris
All things go better with Mint. Mint julep, mint jelly, mint gum, candy mints, pillow mints, peppermint, chocolate mints, spearmint,....
Dirkoir
Level 4
Level 4
Posts: 329
Joined: Wed Jul 30, 2014 12:43 pm

Re: How to add a script in Startup Applications to all accou

Post by Dirkoir »

Thanks, eanfrid! :-) Following your lead, I browsed to /home/dirkoir/.config/autostart where I found a single file named: xset.desktop

Looking inside the file, it contained:

Code: Select all

[Desktop Entry]
Type=Application
Exec=xset s off
Hidden=false
NoDisplay=false
X-GNOME-Autostart-enabled=true
Name[en_US]=Prevent Screen Blanking
Name=Prevent Screen Blanking
Comment[en_US]=Hopefully I can leave laptop unattended now.
Comment=Hopefully I can leave laptop unattended now.
X-GNOME-Autostart-Delay=0
That would seem to be the script. Neat! :-) Now, if I copy it to /etc/xdg/autostart, I will also need to change it's owner and group privileges from dirkoir to root, right?

(Afterwards, I suppose I can and should delete my own personal dirkoir-only autostart script which would now be redundant. Too bad the GUI tool only works on a per-user basis. If it weren't restricted that way, the GUI tool would make global adjustments easier to find and manage.)
______
Linux Mint 17 Cinnamon 64-bit | LM19 Cinnamon | LM20.1 MATE | LM20.3 Cinnamon
altair4
Level 20
Level 20
Posts: 11460
Joined: Tue Feb 03, 2009 10:27 am

Re: How to add a script in Startup Applications to all accou

Post by altair4 »

Now, if I copy it to /etc/xdg/autostart, I will also need to change it's owner and group privileges from dirkoir to root, right?
Nope. The reason it's "nope" is because you can't copy it to /etc/xdg/autostart as dirkoir.

You need to do this as sudo:

Code: Select all

sudo cp /home/dirkoir/.config/autostart/xset.desktop /etc/xdg/autostart
When you do that you copy as root and the file will save with root as owner automatically.
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
Dirkoir
Level 4
Level 4
Posts: 329
Joined: Wed Jul 30, 2014 12:43 pm

Re: How to add a script in Startup Applications to all accou

Post by Dirkoir »

Haha, the thought had recently occurred to me, too. (guess, I must be learning) :D

I guess, I could do it via the GUI, too: gksu nemo
______
Linux Mint 17 Cinnamon 64-bit | LM19 Cinnamon | LM20.1 MATE | LM20.3 Cinnamon
Locked

Return to “Beginner Questions”