|
@@ -151,6 +151,30 @@ const main: JupyterLabPlugin<void> = {
|
|
|
return (event as any).returnValue = message;
|
|
|
}
|
|
|
});
|
|
|
+
|
|
|
+ let isBusy = false;
|
|
|
+ const favicon = document.querySelector('link[rel="shortcut icon"]') as HTMLLinkElement;
|
|
|
+ const icons = ['favicon-busy-1.ico', 'favicon-busy-3.ico', 'favicon-busy-3.ico'];
|
|
|
+
|
|
|
+ let interval = 0;
|
|
|
+ let i = 0;
|
|
|
+
|
|
|
+ app.serviceManager.sessions.runningChanged.connect((_, sessions) => {
|
|
|
+ const newIsBusy = sessions.map(s => s.kernel.execution_state).indexOf('busy') !== -1;
|
|
|
+ if (newIsBusy !== isBusy) {
|
|
|
+ isBusy = newIsBusy;
|
|
|
+ console.log({isBusy});
|
|
|
+ if (isBusy && !interval) {
|
|
|
+ interval = window.setInterval(() => {
|
|
|
+ favicon.href = `/static/base/images/${icons[i++ % 3]}`;
|
|
|
+ }, 300);
|
|
|
+ } else {
|
|
|
+ window.clearInterval(interval);
|
|
|
+ favicon.href = '/static/base/images/favicon.ico';
|
|
|
+ interval = i = 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
},
|
|
|
autoStart: true
|
|
|
};
|