Can i make a launcher shortcut perform different actions based on a condition

Posted by Nirmik on Ask Ubuntu See other posts from Ask Ubuntu or by Nirmik
Published on 2012-06-29T12:48:07Z Indexed on 2012/07/09 21:23 UTC
Read the original article Hit count: 281

Filed under:
|

What i want to do is pretty simple to understand.

I want the same launcher shortcut to act like a ON/OFF swith for eg.

Like suppose i have made a launcher to start LAMPP with the command gksudo /opt/lampp/lampp start

This works properly to start lampp. Now,what i want to do is,If LAMPP is not on,the launcher should execute the above command and start lampp.While if lampp is on,I want ti to execute the command gksudo /opt/lampp/lampp stop and stop lampp.

I want these 2 commands to be executed by the same launcher where the command to be executed is decided on the basis of a condition(LAMPP being ON or OFF in the above example)

Can i do this? and how?

I guess writing a bash script and then making the launcher execute the bash script would do it.but then how do i check weather lampp is on of off?

© Ask Ubuntu or respective owner

Related posts about launcher

Related posts about shortcuts