Skip to content

Commit

Permalink
Add ability to toggle top bar
Browse files Browse the repository at this point in the history
  • Loading branch information
joouha committed Aug 31, 2022
1 parent 3e92692 commit 942ce5f
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 14 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Upcoming
Added
=====

- Add ability to toggle top bar visibility
- Use cursor shapes to show the current input mode

Fixed
Expand Down
48 changes: 34 additions & 14 deletions euporie/notebook/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ def load_container(self) -> "FloatContainer":
dont_extend_width=True,
)

self.title_bar = ConditionalContainer(
title_bar = ConditionalContainer(
Window(
content=FormattedTextControl(self.format_title, show_cursor=False),
height=1,
Expand Down Expand Up @@ -220,22 +220,28 @@ def load_container(self) -> "FloatContainer":
self.dialogs["shortcuts"] = ShortcutsDialog(self)
self.dialogs["msgbox"] = MsgBoxDialog(self)

self.menu_bar = MenuBar(app=self, menu_items=self.load_menu_items())
top_bar = ConditionalContainer(
content=VSplit(
[
self.logo,
MenuBar(app=self, menu_items=self.load_menu_items()),
title_bar,
]
),
filter=self.config.filter("show_top_bar"),
)

self.container = FloatContainer(
content=HSplit(
[
VSplit([self.logo, self.menu_bar, self.title_bar]),
HSplit(
[
tab_bar,
DynamicContainer(self.tab_container),
self.pager,
self.search_bar,
StatusBar(),
],
style="class:body",
),
]
top_bar,
tab_bar,
DynamicContainer(self.tab_container),
self.pager,
self.search_bar,
StatusBar(),
],
style="class:body",
),
floats=cast("list[Float]", self.floats),
)
Expand Down Expand Up @@ -542,12 +548,26 @@ def _view_documentation() -> "None":
""",
)

add_setting(
name="show_top_bar",
flags=["--show-top-bar"],
type_=bool,
title="top bar",
help_="Show the top bar",
default=True,
schema={"type": "boolean"},
description="""
Whether the top bar should be shown at the top of the screen.
""",
)

# ################################# Key Bindings ##################################

register_bindings(
{
"euporie.notebook.app.NotebookApp": {
"new-notebook": "c-n",
"toggle-show-top-bar": ("escape", "m"),
}
}
)

0 comments on commit 942ce5f

Please sign in to comment.