how to automate terminal command at start up or icon click?

Using applications, configuring, problems
Post Reply
Message
Author
puppylinuxuser
Posts: 16
Joined: Thu 09 Jan 2014, 18:59

how to automate terminal command at start up or icon click?

#1 Post by puppylinuxuser »

hi i'm sorry the searches I found didn't explain what i'm trying to do.

So I slack 5.7 on a laptop that i hook up to my flatscreen.

when I use this setup I normally turn off the laptop screen with the following terminal command

xrandr --output LVDS1 --off

couple questions:

1) how do i automate this to happen when it detects external screen OR even how do i make an icon that activates this command instead of having to type it in each time?

2) let's say I want to turn the laptop screen back on...I tried that command with an --on cue but that doesn't work. Is there a way to turn the laptop screen back on with a command?

thank you very much for the help!

stemsee

desktop button

#2 Post by stemsee »

make a script: use a text editor, first line should be #!/bin/sh
then then write your command on the next line. Make sure you press enter so that cursor goes too the next line. Then save you script /root/my-applications/bin/lds1-off.sh, next you wil need to make that script executable by right clicking on it and selecting 'properties', then select Exec Owner. Now you can type in a terminal lvds1-off.sh nd it will execute. You can then drag your script from /root/my-applications/bin to the desktop and a menu will open, choose make a symlink. Then right click on that symlink and choose set-icon. Drag an icon into the box and that's all there is to it. I think. There's probably an easier way to do it.

to automate it you'd need to make the script a daemon, ie run in the background monitoring the connection.

o automat at startup copy the scriipt into /root/startup/ and it should fire up each time X Graphical desktop restarts.

EDIT: install Zarfy

Post Reply