Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'd like to click a button that launches my group of applications that I need for graphical design. Then after a few hours be able to close them and open all my social applications (Empathy, Thunderbird, netlog.com, etc...). And sometimes open the group for learning Cantonese.

My PC is average, so not powerful to load all this well in different workplaces. With Unity I even found it better to reduce the workspaces from 4 to 1.

I believe dedicated working like this without distracting applications would help others to become more productive too. I hope somebody can help. Should we make a facilitating program for this?

share|improve this question
add comment

2 Answers

You can make a shell script with something like this :

#!/bin/bash

my_pgrm0 &
my_pgrm1 &
my_pgrm2 &
...
my_pgrmN &

All your programs (from my_pgrm0 to my_pgrmN) will be launched when you execute the script.

For closing the program, same thing with another script :

#!/bin/bash

MY_PGRM_LIST=my_pgrm0 my_pgrm1 my_pgrm2 ... my_pgrmN

for PGRM in $MY_PGRM_LIST; do
    killall $PGRM
    # Or searching the program with ps aux | grep $PGRM, retrieving the process id and then give this process to kill -9
done
share|improve this answer
    
Sorry if I don't understand how this works exactly, but I thought that running "kill" or "killall" would terminate the program immediately, without asking to save unfinished work, and without cleaning up any temporary files or anything like that. Is that a safe way to stop programs? –  Dave M G Jul 17 '12 at 2:53
    
Thanks air-dex, good solution, similar to other answer. –  Johan Jul 17 '12 at 10:19
    
@DaveMG: You are correct. All these methods will close the program immediately, and may be dangerous depending on your work habits; it's a good idea to always save work often and after changes in all cases. –  Marty Fried Jul 17 '12 at 16:18
add comment

This can be done in a number of ways by yourself. The easiest and simplest way is to create simple scripts that are simply a list of programs to run.

If you don't have a directory named "bin" in your home directory, you would want to create one, as this is a default place for such things; from a terminal command, enter from your default home directory: mkdir bin. Then, enter "cd bin" to change to that directory. Run an editor such as gedit in that directory, with a name such as gedit socialapps.sh.

In the editor enter something like this:

#!/bin/sh
empathy &
thunderbird &
xdg-open http://netlog.com &

When done, close the editor, and make the file executable, by entering chmod +x socialapps.sh.

Run the script by using alt-f2, and entering the full name. Then, you may be able to pin it to the launcher, or create a keyboard shortcut.

To close the apps, you would create another similar script, but call it something like "closesocial.sh", and enter commands like this:

pkill empathy &
pkill thunderbird &

For the URL, you'd need to pkill the browser, and I'm not sure how well it will work, especially if you have other browser windows.

There may be more elegant ways to do this, but this should work until you find something better, if you really want it.

share|improve this answer
    
Thanks a lot, it all works. Just had to do some extra permissions stuff and wasn't able to make launcher or desktop icon yet. –  Johan Jul 17 '12 at 10:22
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.