Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto-suspend process when it doesn't have focus (while system is on battery) #142

Closed
jdorseywx opened this issue Jun 19, 2019 · 5 comments
Closed
Labels
Idea-New PowerToy Suggestion for a PowerToy

Comments

@jdorseywx
Copy link

Many apps consume a lot of power while "idle" in the background (Chrome, Visual Studio to name a few), thus draining the battery quickly. When on battery, I often use pssuspend (sysinternals tool) to suspend a process, but then I'm forced to suspend/resume apps that I want to temporarily use.

Request is for a PowerToys option to automatically suspend a process when it doesn't have focus (or after a configurable timeout), then resume that app when focus returns (e.g. via mouse click or alt-tab). This option would be in effect when the system is on battery power, not plugged in. May also need a whitelist of apps that can be suspended, e.g. you may not want some apps suspended ever (Slack, etc.). Thanks!

@ghost
Copy link

ghost commented Jul 2, 2019

That's going to be cool, it's gonna double or even triple your battery life.
Better if there're more customizations, such as :
1.resuming a process for 5 seconds every 1 minute for specified processes to make sure they can receive new messages or work correctly (this should be customizable),
2.an option for whether process should be suspended only when it's minimized,
3.only suspend a process if its cpu time is less than XX.
4.have multiple plans like what power plans does, such as uses plan A when not plugged in and plan B when in battery saver mode.
those make win32 apps more suitable for portable devices, especially when you have your power adapter left at home.
BTW you can use Resource Monitor to suspend/resume a process.

@indierawk2k2
Copy link
Collaborator

These are all great suggestions for a "Power" Power Toy. :)

@indierawk2k2 indierawk2k2 added the Idea-New PowerToy Suggestion for a PowerToy label Jul 3, 2019
ryanbodrug-microsoft pushed a commit to ryanbodrug-microsoft/PowerToys that referenced this issue Apr 14, 2020
* Add handling of portable mode when updating

Additionally: 
1. Changed getting version from internally rather than from RELEASES file
2. Added PortableDataPath as a constant so can be used  to determine if portable mode is used

* Fix incorrectly wired auto update event handler

* Fix Sys plugin missing Shutdown command icon

* Add check update command to Sys plugin

* Add message if current Wox version is latest

* Add default silent when auto checking updates in background

Silent when current is still the latest version

* Move UserData folder to new version location

* Changes per review

1. Move IsPortableMode to Constant
2. Merge if statement

* Per comment- change variables to be more descriptive

UpdateInfo and UpdateManager renamed

* Per comment- Add exception handling and message if failed.
@rcmaehl
Copy link
Contributor

rcmaehl commented Sep 8, 2020

I've actually got a proof of concept application I was developing before I found this suggestion existed.

From tests, if a process is suspended the window doesn't become active, even through Alt-Tab, taskbar, etc. So you'd have to completely work around this somehow. Maybe detecting when the mouse button is clicked on a window? It's no easy fix.

Additionally, there's the concern for custom hardware. Stuff like Corsair hotkeys, and even function buttons on Microsoft's own Multimedia 4000 keyboard stop working. I had to create exclusions for these.

Finally, it'd probably be best to create a blacklist instead of a whitelist if implemented as a powertoy, not just for the previous concern, but in general. Without knowing what the user is going to be using it with and for it's incredibly user-unfriendly to just suspend a process. #146 is a good starting point however.

Regardless, it is a great idea for a powertoy that MS devs can probably do better than myself. Here's the results from my proof of concept on an Intel Atom x5-Z8550:

image

rcmaehl added a commit to rcmaehl/FreezeToStock that referenced this issue Sep 8, 2020
Start addition of features recommended in github.com/microsoft/PowerToys/issues/142
@crutkas
Copy link
Member

crutkas commented Oct 30, 2020

On discussing this, the reason we cannot suspend arbitrary Win32 apps is because they are not isolated from one another (all full trust); they share named objects, can access same files without broker, free window messaging, etc. One example is if you suspend an app that is holding a file open. With UWP, we can find the app that has it and shut it down (it has saved state). With Win32, if you caught the app at the wrong time (opened the file and hasn’t closed yet), the foreground app will fail to get access to the file.

if you suspend something with sysinternals, you're putting your system at risk for instability

@AJolly
Copy link

AJolly commented Oct 28, 2024

I'd be interested, even if it does put my system at risk.

stefansjfw pushed a commit that referenced this issue Dec 18, 2024
Originally in #142 and #144, but github didn't automatically change the base branch 😨 

----- 

As discussed in #77. 

Biggest change is that `IDynamicListPage` doesn't have `GetItems(String query)` anymore. Instead, the host will call the `SearchText` setter, and the list can raise `ItemsChanged` to let the host know to call `GetItems` again

See src/modules/cmdpal/Exts/EverythingExtension/Pages/EverythingExtensionPage.cs for an example of how to update dynamic extensions. 

Closes #131 
Closes #77 

----

* I put the sample pages into a single top-level command, so deploying that extension didn't add 5 top-level commands to your palette
* I tightened up some of the phrasing for the samples, and the builtins, to be less repetitive
* I added a few icons
* I made the markdown sample longer (and work more reliably)
* and also thank you Hawker for auto-format on save, you the man
stefansjfw pushed a commit that referenced this issue Dec 18, 2024
As discussed in #121. 

Adds a new `IListItem.TextToSuggest` property. If an extension populates that, and the user hits right-arrow when the item is selected, we'll set the `SearchText` to that text. 

I didn't give it a UI treatment, because 
1. I'm not good at XAML
2. As noted in zadjii-msft#121 (comment), there's complicated edge cases here. You have to track what's actually been typed, and then also have a ghost suggestion for the very first item (before the user types/up/downs at all). 

I didn't think it was valuable to implement that right now before we have A Real App. 

* targets #144 
  * which targets #142 
    * which targets #141 

and those guys are all merged as of #150
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Idea-New PowerToy Suggestion for a PowerToy
Projects
None yet
Development

No branches or pull requests

5 participants