Jump to content

Need help for idling firefox on minimize


Recommended Posts

Hello,

I have an idea (and partially already use it) for idling firefox on windows 10 if you minimize the firefox window (for saving a lot battery cause firefox has regulary spikes in cpu usage).

For the moment I am using PsSuspend for 'firefox.exe' and 'plugin-container.exe' in a simple batch file that will execute if I do not move the mouse for some time.

 

But now I want to go a step further:

I want to create an autoit script that will check (loop) if there is a firefox window in foreground. If not, it will execute PsSuspend to suspend firefox.

The tricky part is: It would be nice if the same script will notice when I try to get firefox back to foreground and unfreeze (same with PsSuspend) firefox.

 

Any hint/help?

 

 

Link to comment
Share on other sites

Thank you, I tried that. What about?

I need a negation somewhere there. At that moment it will only execute once firefox is launched.

Local $tvHandle = 0
while True
  $tvHandle = WinWait("*-Nightly")         ;I am using Firefox Nightly
  if Not ($tvHandle = 0) Then
     WinActivate ("*-Nightly")          ;if there is none it activates the window
     sleep(20)                           ;some delay to prevent errors or something like that
     launch batch?
  EndIf
WEnd

 

Link to comment
Share on other sites

If you will look closer, you will see this (cpu spikes becomes higher the more tabs are opened due to javascript garbage collection)

Picture

Some Browser like IE11 complete freeze itself if you minimize them. But firefox don't do that and always 'works' even if unused. If you have a laptop battery that only lasts ~ 3h then you might be interested in optimizing it.

Link to comment
Share on other sites

Yes, but I don't like the tab management in chrome if you have more than 30 tabs opened.

 

Basically it's not 'my' issue. It's how firefox is working, chrome is a little bit better in this regard and IE11 is best. The last both are not a good choice in my opinion.

(Forced) idling firefox if mouse is not moved works perfectly but I thought it would be possible someone can help me detecting if firefox is not in foreground anymore.

Edited by koboltzz
Link to comment
Share on other sites

13 hours ago, MuffinMan said:

You could use a loop with WinGetState to see if your firefox window is running minimized - if so, run your suspend command, and when it's not un-suspend it.

^^ This.

Only keep track of whether It is already suspended or not, before you run your utility.

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...