Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Update the browser tab favicon on kernel busy#6980

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
jtpio merged 1 commit intojupyter:mainfromjtpio:tab-icon
Jul 27, 2023
Merged
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Update browser tab favicon on kernel busy
  • Loading branch information
@jtpio
jtpio committedJul 24, 2023
commit14a5754a07034f73312eefd028a9a69e68c19255
48 changes: 47 additions & 1 deletionpackages/notebook-extension/src/index.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -402,6 +402,51 @@ const notebookToolsWidget: JupyterFrontEndPlugin<void> = {
},
};

/**
* A plugin to update the tab icon based on the kernel status.
*/
consttabIcon:JupyterFrontEndPlugin<void>={
id:'@jupyter-notebook/notebook-extension:tab-icon',
autoStart:true,
requires:[INotebookTracker],
activate:(app:JupyterFrontEnd,tracker:INotebookTracker)=>{
// the favicons are provided by Jupyter Server
constnotebookIcon=' /static/favicons/favicon-notebook.ico';
constbusyIcon=' /static/favicons/favicon-busy-1.ico';

constupdateBrowserFavicon=(
status:ISessionContext.KernelDisplayStatus
)=>{
constlink=document.querySelector(
"link[rel*='icon']"
)asHTMLLinkElement;
switch(status){
case'busy':
link.href=busyIcon;
break;
case'idle':
link.href=notebookIcon;
break;
}
};

constonChange=async()=>{
constcurrent=tracker.currentWidget;
constsessionContext=current?.sessionContext;
if(!sessionContext){
return;
}

sessionContext.statusChanged.connect(()=>{
conststatus=sessionContext.kernelDisplayStatus;
updateBrowserFavicon(status);
});
};

tracker.currentChanged.connect(onChange);
},
};

/**
* A plugin that adds a Trusted indicator to the menu area
*/
Expand DownExpand Up@@ -441,8 +486,9 @@ const plugins: JupyterFrontEndPlugin<any>[] = [
closeTab,
kernelLogo,
kernelStatus,
scrollOutput,
notebookToolsWidget,
scrollOutput,
tabIcon,
trusted,
];

Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp