Skip to content

Commit 006178a

Browse files
author
Neel Shah
committed
Add custom CSS support to JupyterLab launcher
1 parent 662e743 commit 006178a

2 files changed

Lines changed: 20 additions & 1 deletion

File tree

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/*
2+
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
.jp-ImageViewer img {
7+
pointer-events: none;
8+
}

src/graph_notebook/start_jupyterlab.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,31 @@
44
"""
55

66
import os
7+
import shutil
78
import argparse
9+
from pathlib import Path
810
from graph_notebook.ipython_profile.configure_ipython_profile import configure_magics_extension
911

1012

13+
def install_custom_css():
14+
config_dir = Path(os.environ.get('JUPYTER_CONFIG_DIR', os.path.expanduser('~/.jupyter')))
15+
dest = config_dir / 'custom'
16+
dest.mkdir(parents=True, exist_ok=True)
17+
src = Path(__file__).parent / 'jupyter_profile' / 'custom' / 'custom.css'
18+
shutil.copy2(src, dest / 'custom.css')
19+
20+
1121
def main():
1222
parser = argparse.ArgumentParser()
1323
parser.add_argument('--jupyter-dir', default='', type=str, help='The directory to start Jupyter from.')
1424

1525
args = parser.parse_args()
1626

1727
configure_magics_extension()
28+
install_custom_css()
1829

1930
jupyter_dir = '~/notebook/destination/dir' if args.jupyter_dir == '' else args.jupyter_dir
20-
os.system(f'''jupyter lab {jupyter_dir}''')
31+
os.system(f'''jupyter lab --custom-css {jupyter_dir}''')
2132

2233

2334
if __name__ == '__main__':

0 commit comments

Comments
 (0)