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.

In this question a script is provided, that minimizes all the other windows except the active one. But the thing is, to trigger this script a (shortcut) key-combination has to be pressed.

I would love it, if it would be possible to automate this behavior, i.e. no matter what I do, only the active window is not minimized. This way I cannot view more then one open window at the same tine, which is what I'm after. Is it possible to write a script, that does this ?

I a question I asked a while ago (where I learned about the above script), someone said, the proper way to do this, would be through a wrapper through which every program starts.

I would also be very happy with a more sloppy solution, like activating this script 100 times per second (simulating pressing the shortcut combination a 100 times per second), if it is feasible - although I was warned, that that may not be a very good idea.

share|improve this question

1 Answer 1

up vote 3 down vote accepted

You could use cron to schedule the call of your script, but cron can only run a script every minute. It can't go faster than this, so it is probably not fast enough for your use.

It sounds like a really bad idea to run every few milliseconds, but if that's what you really want you can run the script below in the background:

while true; do
    /path/to/your/script.sh 
    sleep 0.01
done
share|improve this answer
    
Before I might wreck my system, by letting it run, lets say 10 times a second (that sound reasonable it terms of speed to me), why is it such a bad idea ? Will the system just freeze ? –  user10324 Oct 2 '12 at 10:35
    
Could you also please tell me the path in which I have to copy this script so that cron can call it ? –  user10324 Oct 2 '12 at 10:35
    
This is not called by cron (as I said (but I was probably not clear enough), cron can't run faster than once per minute). This script is run on its own. Just run it when starting your session (e.g. add a startup application) and it'll run until you kill it or stop your computer. You can save the script anywhere you want. –  Ugo Oct 2 '12 at 12:32
    
It can be a bad idea to run it very 1/10s as it may overload your system quite a bit (not sure how cpu intensive your script is). But you can always test it and see what happens (it won't do anything bad, just check if you can still use your computer or if it is too slow). –  Ugo Oct 2 '12 at 12:38

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.