Skip to content

Commit e9d49c7

Browse files
authored
Merge pull request #14 from mwakaba2/update-notebook-name
Update notebook name in Notification title.
2 parents 14d5fd4 + ace4ce3 commit e9d49c7

File tree

3 files changed

+18
-15
lines changed

3 files changed

+18
-15
lines changed

src/index.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ function displayNotification(
4646
}
4747

4848
notificationPayload.body = message;
49-
new Notification(`${notebookName} Cell Completed!`, notificationPayload);
49+
new Notification(`${notebookName}`, notificationPayload);
5050
}
5151

5252
const extension: JupyterFrontEndPlugin<void> = {
@@ -95,7 +95,10 @@ const extension: JupyterFrontEndPlugin<void> = {
9595
cellNumberType === 'cell_index'
9696
? notebook.activeCellIndex
9797
: codeCellModel.executionCount;
98-
const notebookName = notebook.title.label;
98+
const notebookName = notebook.title.label.replace(
99+
/\.[^/.]+$/,
100+
''
101+
);
99102
displayNotification(
100103
cellDuration,
101104
cellNumber,

static/images/notification.png

1.33 KB
Loading

tutorial/py3_demo.ipynb renamed to tutorial/notebook_notification_py3_demo.ipynb

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
"cells": [
33
{
44
"cell_type": "code",
5-
"execution_count": 3,
5+
"execution_count": 1,
66
"metadata": {
77
"execution": {
8-
"iopub.execute_input": "2021-04-20T02:52:00.612541Z",
9-
"iopub.status.busy": "2021-04-20T02:52:00.612207Z",
10-
"iopub.status.idle": "2021-04-20T02:52:00.616928Z",
11-
"shell.execute_reply": "2021-04-20T02:52:00.615808Z",
12-
"shell.execute_reply.started": "2021-04-20T02:52:00.612490Z"
8+
"iopub.execute_input": "2021-05-16T01:17:43.398697Z",
9+
"iopub.status.busy": "2021-05-16T01:17:43.398438Z",
10+
"iopub.status.idle": "2021-05-16T01:17:43.406473Z",
11+
"shell.execute_reply": "2021-05-16T01:17:43.405574Z",
12+
"shell.execute_reply.started": "2021-05-16T01:17:43.398631Z"
1313
},
1414
"tags": []
1515
},
@@ -28,14 +28,14 @@
2828
},
2929
{
3030
"cell_type": "code",
31-
"execution_count": 4,
31+
"execution_count": 2,
3232
"metadata": {
3333
"execution": {
34-
"iopub.execute_input": "2021-04-20T02:52:00.619017Z",
35-
"iopub.status.busy": "2021-04-20T02:52:00.618717Z",
36-
"iopub.status.idle": "2021-04-20T02:52:03.748053Z",
37-
"shell.execute_reply": "2021-04-20T02:52:03.746867Z",
38-
"shell.execute_reply.started": "2021-04-20T02:52:00.618964Z"
34+
"iopub.execute_input": "2021-05-16T01:17:43.408122Z",
35+
"iopub.status.busy": "2021-05-16T01:17:43.407871Z",
36+
"iopub.status.idle": "2021-05-16T01:17:46.537467Z",
37+
"shell.execute_reply": "2021-05-16T01:17:46.536828Z",
38+
"shell.execute_reply.started": "2021-05-16T01:17:43.408099Z"
3939
},
4040
"tags": []
4141
},
@@ -138,7 +138,7 @@
138138
"name": "python",
139139
"nbconvert_exporter": "python",
140140
"pygments_lexer": "ipython3",
141-
"version": "3.7.10"
141+
"version": "3.8.5"
142142
}
143143
},
144144
"nbformat": 4,

0 commit comments

Comments
 (0)