diff --git a/installer.py b/installer.py index 6169857e0..a5501529d 100644 --- a/installer.py +++ b/installer.py @@ -11,7 +11,7 @@ try: from modules.cmd_args import parser except: import argparse - parser = argparse.ArgumentParser(description="Stable Diffusion", conflict_handler='resolve', formatter_class=lambda prog: argparse.HelpFormatter(prog, max_help_position=55, indent_increment=2, width=200)) + parser = argparse.ArgumentParser(description="SD.Next", conflict_handler='resolve', formatter_class=lambda prog: argparse.HelpFormatter(prog, max_help_position=55, indent_increment=2, width=200)) class Dot(dict): # dot notation access to dictionary attributes __getattr__ = dict.get diff --git a/javascript/notification.js b/javascript/notification.js index 712d64258..d443d5474 100644 --- a/javascript/notification.js +++ b/javascript/notification.js @@ -2,32 +2,32 @@ let lastHeadImg = null; let notificationButton = null; -const regExpTempImage = /(?<=\/|\\)tmp[\w\d]{8}\.png$/gm; onUiUpdate(function(){ - if(notificationButton == null){ - notificationButton = gradioApp().getElementById('request_notifications') - if (notificationButton != null) notificationButton.addEventListener('click', (evt) => Notification.requestPermission(), true); + if (!notificationButton) { + notificationButton = gradioApp().getElementById('request_notifications') + if (notificationButton) notificationButton.addEventListener('click', (evt) => Notification.requestPermission(), true); } const galleryPreviews = gradioApp().querySelectorAll('div[id^="tab_"][style*="display: block"] div[id$="_results"] .thumbnail-item > img'); - if (galleryPreviews == null) return; - const headImg = galleryPreviews[0]?.src; - if (headImg == null || headImg == lastHeadImg) return; - if (headImg.search(regExpTempImage) != -1) return; - lastHeadImg = headImg; - // play notification sound if available + if (!galleryPreviews) return; + + if (document.hasFocus()) return; // window is in focus so don't send notifications + const audioNotification = gradioApp().querySelector('#audio_notification audio'); if (audioNotification) audioNotification.play(); - if (document.hasFocus()) return; - // Multiple copies of the images are in the DOM when one is selected. Dedup with a Set to get the real number generated. - const imgs = new Set(Array.from(galleryPreviews).map(img => img.src)); + + const headImg = galleryPreviews[0]?.src; + if (!headImg || headImg == lastHeadImg || headImg.endsWith('automatic.png')) return; + lastHeadImg = headImg; + console.log(headImg) + const imgs = new Set(Array.from(galleryPreviews).map(img => img.src)); // Multiple copies of the images are in the DOM when one is selected const notification = new Notification( - 'Stable Diffusion', { + 'SD.Next', { body: `Generated ${imgs.size > 1 ? imgs.size - opts.return_grid : 1} image${imgs.size > 1 ? 's' : ''}`, icon: headImg, image: headImg } ); - notification.onclick = function(_) { + notification.onclick = () => { parent.focus(); this.close(); }; diff --git a/javascript/progressbar.js b/javascript/progressbar.js index 7d218ff05..1eb49c35a 100644 --- a/javascript/progressbar.js +++ b/javascript/progressbar.js @@ -37,9 +37,10 @@ function formatTime(secs) { } function setTitle(progress) { - var title = 'Stable Diffusion' - if(opts.show_progress_in_title && progress) title = '[' + progress.trim() + '] ' + title; - if(document.title != title) document.title = title; + var title = 'SD.Next' + console.log('progress:', progress) + if (progress) title += ' ' + progress.split(' ')[0].trim(); + if (document.title != title) document.title = title; } function randomId() { diff --git a/modules/ui.py b/modules/ui.py index 5fca87597..412fafbee 100644 --- a/modules/ui.py +++ b/modules/ui.py @@ -1368,7 +1368,7 @@ def create_ui(): for _interface, label, _ifid in interfaces: shared.tab_names.append(label) - with gr.Blocks(theme=shared.gradio_theme, analytics_enabled=False, title="Stable Diffusion") as demo: + with gr.Blocks(theme=shared.gradio_theme, analytics_enabled=False, title="SD.Next") as demo: with gr.Row(elem_id="quicksettings", variant="compact"): for i, k, item in sorted(quicksettings_list, key=lambda x: quicksettings_names.get(x[1], x[0])): component = create_setting_component(k, is_quicksettings=True) diff --git a/wiki b/wiki index ab46c9f35..fad4a1168 160000 --- a/wiki +++ b/wiki @@ -1 +1 @@ -Subproject commit ab46c9f3583bbd155623fd7d59a969a353aa96be +Subproject commit fad4a11686c93951f9b6a8a4f847c7915f708118