diff --git a/BOARD.txt b/BOARD.txt index b45c355..3b7f1c1 100644 --- a/BOARD.txt +++ b/BOARD.txt @@ -19,7 +19,7 @@ TODO DONE media files identity management logging -home page + home page diff --git a/bebop/browser/browser.py b/bebop/browser/browser.py index c5c162f..e26c220 100644 --- a/bebop/browser/browser.py +++ b/bebop/browser/browser.py @@ -36,6 +36,7 @@ from bebop.navigation import ( ) from bebop.page import Page from bebop.page_pad import PagePad +from bebop.welcome import WELCOME_PAGE class Browser: @@ -106,16 +107,13 @@ class Browser: def setup_special_pages(self): """Return a dict with the special pages functions.""" return { + "welcome": { "open": self.open_welcome_page }, + "help": { "open": self.open_help }, + "history": { "open": self.open_history }, "bookmarks": { "open": self.open_bookmarks, "source": lambda: str(get_bookmarks_path()) }, - "help": { - "open": self.open_help, - }, - "history": { - "open": self.open_history, - }, } def run(self, *args, **kwargs): @@ -309,6 +307,8 @@ class Browser: if num_words == 1: if command in ("q", "quit"): self.running = False + elif command in ("h", "home"): + self.open_home() return if command in ("o", "open"): self.open_url(words[1]) @@ -643,3 +643,11 @@ class Browser: ) except FileNotFoundError as exc: self.set_status_error(f"Failed to run command: {exc}") + + def open_home(self): + """Open the home page.""" + self.open_url(self.config["home"]) + + def open_welcome_page(self): + """Open the default welcome page.""" + self.open_internal_page("welcome", WELCOME_PAGE) diff --git a/bebop/config.py b/bebop/config.py index e18ff00..5bf6b23 100644 --- a/bebop/config.py +++ b/bebop/config.py @@ -13,7 +13,8 @@ DEFAULT_CONFIG = { "command_editor": ["vi"], "history_limit": 1000, "external_commands": {}, - "external_command_default": ["xdg-open"] + "external_command_default": ["xdg-open"], + "home": "bebop:welcome", } diff --git a/bebop/welcome.py b/bebop/welcome.py new file mode 100644 index 0000000..108a5ea --- /dev/null +++ b/bebop/welcome.py @@ -0,0 +1,13 @@ +"""Welcome page.""" + +WELCOME_PAGE = """\ +# Bebop + +Hi! Welcome to the Bebop browser. + +Press "?" to see the keybinds, commands and more, or click the link below by \ +pressing its link ID (1). + +=> bebop:help Help +=> gemini://dece.space/dev/bebop.gmi Bebop @ dece.space +"""