4

Is there any way to make Ubuntu 12.04 understand when it should suspend or not in terms of the software that is currently running?

For example, if I am installing something and it takes more than 10 minutes, which is the time limit for my PC to suspend, then I do not want my system to system to suspend till the installation of the program is finished. If my system is inactive I want it to suspend,but on the other hand if something is running I do not want to suspend.

  • Do you want to know how could you turn off the suspension option or only when a program is open? – Lucio Aug 30 '12 at 23:32
  • I want to prevent my system to suspend when a program is doing something.For example if I am installing something and it takes more than 10 minutes,which is the time limit for my pc to suspend,then I do not want my system to system to suspend till the installation of the program is finished.If my system is inactive I want it to suspend,but on the other hand if something is running I do not want to suspend. – und3rd06012 Aug 31 '12 at 9:12
  • 1
    Sorry, I don't know how to do that. My advice is disable the suspention when will run a application until someone tells you how. – Lucio Sep 1 '12 at 2:25
4

A relatively simple way to do it is by installing a program called caffeine. You'll need to add the repository then install it. For example, via the terminal.

sudo add-apt-repository ppa:caffeine-developers/ppa && sudo apt-get update && sudo apt-get install caffeine && sudo apt-get install gir1.2-appindicator3-0.1 gir1.2-notify-0.7

(N.B. you'll need gir1.2-appindicator3-0.1 and gir1.2-notify-0.7 at the moment due to a bug in defining its dependencies.)

Once you have it installed and running, it should create an entry in the menubar or panel. You can manually prevent suspension, or set caffeine to activate automatically based on what processes are running. In your case, you can whitelist the installation program, such as apt-get. (I'm not sure what that is specifically, since you didn't provide the details.)

enter image description here

N.B. I'm using Kubuntu, where it works well. It should also work in Unity.


Update

New versions of caffeine have been crippled, and much of this functionality has been removed.. I think the old version (2.5) still works, though, so you can try that.

  • Hm… I read the OP before edits, and now I'm not sure if the "automatic activation" function of caffeine is useful, given that you don't want to prevent suspension when Virtualbox or the web browser is running, just when something specific is happening. In any case, you can just use caffeine's manual function, as a quick way to prevent suspension (when you remember!). – Sparhawk Mar 9 '13 at 1:22
2

How to disabled the Suspend function, even if a program is running or not:

You have to goto the System Configuration and then click on Energy option. Now you should see an image similar than this one: energy

Then you will see the option called Suspend when inactive for and put this one on Don't Suspend, as you see on the previously image.

0

I do solve such things automating keyboard with xdotool package, using it in a dead-simple loop inside a terminal.

while true; do xdotool mousemove 0 0 && sleep 30; done

This will make your computer to be up untill you stop this process by moving mouse to coords 0 0 every 30 seconds.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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