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

WinBGMute seems to "go to sleep" after an undefined period of time #30

Closed
mercster opened this issue Aug 28, 2023 · 10 comments
Closed

WinBGMute seems to "go to sleep" after an undefined period of time #30

mercster opened this issue Aug 28, 2023 · 10 comments
Labels
bug Something isn't working

Comments

@mercster
Copy link

After a few hours it seems, WinBGMute will "go to sleep" and stop actively muting/unmuting windows as they get/lose focus. Hard to define when this happens, as it would require dedicated testing over several hours, which I have not done. I also note noone else has posted this issue, so I'm not sure. I have all power management off on my machine... I never sleep, hibernate, or otherwise allow my PC to go into a low power situation. I can tell when this happens because I notice it, I will put a window in the background and it is not muted. If I go to where WinBGMute is minimized in the system tray and open the window, it instantly "springs to life" and starts working again. It takes awhile for it to happen, but it does happen. Sorry I can't give any steps to reproduce.

Windows 11 fully patched x86-64
Latest WinBGMute

@nefares
Copy link
Owner

nefares commented Sep 13, 2023

Hmm that is a strange behavior. I'll keep an eye on it when that happens on my machine.

The next time that happens and before reopening Background-Muter, could you check the following:

  • Note what you were doing (or not doing) before: were inactive for a long time? did you open a specific program?
  • Task manager > Details > WinBGMute.exe : does the process show up as "Suspended"?

Then after you reopen Background-Muter, please copy the log from the log window and paste it here.

A possible fix is to run Background-Muter as an Administrator and check if the problem persists.

If this keeps happening, maybe windows is interfering with the utility somehow. It could also be a win11 issue but I'm not sure what's causing it. Maybe an upgrade of the whole project to dotnet 7 or dotnet 8 can fix this.

@nefares nefares added the bug Something isn't working label Sep 13, 2023
@mercster
Copy link
Author

Yeah, that gives me some things to do... I will catch myself next time and look at the process list next time to see if anything looks iffy. And will make sure to copy/paste log. Admin rights is another idea, but if I can I'd like to track this down for you. Will keep a look out, thanks.

@mercster
Copy link
Author

mercster commented Sep 24, 2023

Hello there,

OK so it happened to me last night. I could tell it wasn't muting a game I was playing while it was in the background. Before raising it from the notification area, I checked it in Process list. Status was "Running", not Suspended or anything else.

I went into the notification area, the icon was there. When I clicked it to bring up the window, the game (which was in the background obviously) instantly muted and the WinBGMute UI came up. The log was very short:

Setting autostart @C:\Users\merc\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup -> Background Muter.lnk
[+] Summary: skipped () and muted (SpotifyWidgetProvider, PowerToys.Peek.UI, steam, ShellExperienceHost, [PROCESS NAME REDACTED)
[+] Foreground process changed to chrome - 11968
[+] Summary: skipped () and muted (SpotifyWidgetProvider, PowerToys.Peek.UI, steam, ShellExperienceHost, PROCESS NAME REDACTED, )
[+] Foreground process changed to explorer - 7296

I removed the game name, but it was just the name of the application and what I assume to be a thread label of some sort. The first line is curious, as if it was just started when I "brought it back to life" via the notification area icon. It was definitely running and in the process list, but the log seems to have started just as I re-awakened it. There are no timestamps in the log, those might be a profitable addition? Anyway... yeah, nothing I see outwardly that would let me know what's happening.

Hard for me to know exactly when the behavior started anyway, as... well, I am not constantly putting applications with sound output in the background (and those that I do, for instance Chrome, are in the exception lists.)

EDIT: Should note that this is not just happening with one weird game/program... I notice it happening from time to time with various programs. This is incredibly hard to test of course in a structured way.

EDIT2: Thoughts going forward... is there a switch I can give the program to enable more verbose logging? And is there a log on-disk somewhere? (I copied the above from the GUI widget that displays the log.)

@mercster
Copy link
Author

Happened again... I could tell it was not "working", although the process was Running in task list, and the icon was in the notification tray. Double click the icon, window pops up and instantly mutes everything in the background, and acts like it just started:

Setting autostart @C:\Users\merc\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup -> Background Muter.lnk
[+] Summary: skipped (chrome, Discord, ) and muted (steam, PowerToys.Peek.UI, SpotifyWidgetProvider, Idle, nwmain, )
[+] Foreground process changed to nwmain - 3372
[+] Unmuting foreground process nwmain(3372) .
[+] Summary: skipped (chrome, Discord, ) and muted (steam, PowerToys.Peek.UI, SpotifyWidgetProvider, Idle, )
[+] Foreground process changed to explorer - 7976
[+] Summary: skipped (chrome, Discord, ) and muted (steam, PowerToys.Peek.UI, SpotifyWidgetProvider, Idle, nwmain, )
[+] Summary: skipped (chrome, Discord, ) and muted (steam, PowerToys.Peek.UI, SpotifyWidgetProvider, Idle, nwmain, )
[+] Foreground process changed to nwmain - 3372
[+] Unmuting foreground process nwmain(3372) .
[+] Summary: skipped (chrome, Discord, ) and muted (steam, PowerToys.Peek.UI, SpotifyWidgetProvider, Idle, )
[+] Foreground process changed to WinBGMuter - 18236
[+] Summary: skipped (chrome, Discord, ) and muted (steam, PowerToys.Peek.UI, SpotifyWidgetProvider, Idle, nwmain, )

It should be noted this only happens after quite a few hours of not using the computer. I don't have any power saving/etc turned on, but sometimes I will keep the computer on for 20+ hours (I usually reboot around once a day, but this seems to happen definitely after a good amount of time the box has been on.) It seems to be that WinBGMute is putting itself to sleep, or Windows is doing it, not sure. Maybe there's a keepalive you can run every hour or so, if there's no Windows being moved around (for instance, if I am asleep, that's a good 8-10 hours it doesn't have anything to "do", maybe Windows tries to put it into a background process that makes it non-functional or something. But have to reiterate, it is "Running" in process list, not sleep mode or anything.)

@Kaiji-Kun
Copy link

Same thing has been happening to me on fully patched Windows 11 x64. Bringing Background-Muter to the foreground solves the problem as you mentioned but it's annoying because it happens at least once daily. I hope a fix is possible.

@nefares
Copy link
Owner

nefares commented Dec 18, 2023

Hi , apologies the answer took a bit long, I did not have access to my computer for a while.

Thanks @mercster for the detailed feedback and testing.

I implemented the following changes:

  • Keep Alive message every 10min
  • Timestamp for logging messages
  • Other smaller changes

I'm still not sure what is actually happening... I haven't found anything related to this on MSDN... It does seem related to idleness of Windows/Window-Switching. I hope the new changes can provide more insight on this.

Please use the pre-release v1.0.9: https://github.com/nefares/Background-Muter/releases/tag/v1.0.9

Again your input is valuable on this, feel free to comment once you had a chance to test this.

@Kaiji-Kun
Copy link

It's been working perfectly for the last 48 hours. No need to bring the process to the foreground. Thanks for this fix!

@mercster
Copy link
Author

Can't test ATM as I am on a Linux kick (once a year I switch from Linux to Windows, or Windows to Linux, and stay there for about a year. I run one until it pisses me off enough, then switch back and repeat) but thanks for your continued work on this, and I am sure when I run Windows sometime in the future as my main OS I will look forward to testing the fix! Glad I could help with the bug report. Cheers, Merry Christmas. 👍

@mercster
Copy link
Author

(On that note I have attempted to write a script that does what WinBGMute does for Linux, but it requires more knowledge than I possess about the ever-changing sound backend/daemons that Linux uses, and have come up short.)

@nefares
Copy link
Owner

nefares commented Dec 29, 2023

Thanks to you both the feedback! Will close the issue as it seems to be fixed for now.

A linux port of the tool could be interesting. I have added the feature #31 in case @mercster you want to document some of your efforts.

Happy holidays!

@nefares nefares closed this as completed Dec 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants