AUTOMATIC1111 / stable-diffusion-webui

Stable Diffusion web UI
GNU Affero General Public License v3.0
142.56k stars 26.89k forks source link

[Feature Request]: play notification.mp3 only when the window is not focused #7505

Open Zyin055 opened 1 year ago

Zyin055 commented 1 year ago

Is there an existing issue for this?

What would your feature do ?

Using a notification.mp3 file to play when a generation finishes is nice, but it plays even when I'm looking at the browser tab when the image finishes. Ideally it'd only play to get my attention when I'm alt tabbed out.

There is a very simple code change to do this. In notification.js:29 change:

gradioApp().querySelector('#audio_notification audio')?.play();

to

if (!document.hasFocus()) {
    gradioApp().querySelector('#audio_notification audio')?.play();
}

Proposed workflow

  1. Add a notification.mp3 file to the root SD folder
  2. Click generate
  3. only hear the notification.mp3 if window/tab is not focused

Additional information

No response

mezotaken commented 1 year ago

Some may have it focused, but they're not using the device at the moment, waiting for the signal. So we'd probably need a setting to enable this behavior.