Open app in native view on starting it in GUI mode instead of on web browser

- Opens settings page on first run and landing page after in GUI mode
  Previously was only opening the GUI on linux after first run as it
  doesn't have a system tray
- Both the views are from the web interface but are rendered within
  the app instead of the browser
This commit is contained in:
Debanjum Singh Solanky 2023-08-07 13:29:40 -07:00
parent 9c494705a8
commit ea734ba1c8
2 changed files with 4 additions and 10 deletions

View file

@ -24,7 +24,7 @@ For more detailed Windows installation and troubleshooting, see [Windows Install
### 2. Start
Run the following command from your terminal to start the Khoj backend and open Khoj in your browser.
Run the following command in your terminal to start the Khoj backend and open the Khoj native GUI
```shell
khoj --gui

View file

@ -12,7 +12,6 @@ import logging
import threading
import warnings
from platform import system
import webbrowser
# Ignore non-actionable warnings
warnings.filterwarnings("ignore", message=r"snapshot_download.py has been made private", category=FutureWarning)
@ -100,15 +99,10 @@ def run():
server = ServerThread(start_server_func=lambda: start_server(app, host=args.host, port=args.port))
logger.info(f"🌗 Khoj is running at {url}")
try:
startup_url = url if args.config else f"{url}/config"
webbrowser.open(startup_url)
except:
logger.warning(f"🚧 Unable to open browser. Please open {url} manually to configure or use Khoj.")
# Show Main Window on First Run Experience or if on Linux
if args.config is None or system() not in ["Windows", "Darwin"]:
main_window.show()
# Show config window on first run and main window otherwise
startup_window = main_window.show_page() if args.config else main_window.show_page("config")
startup_window()
# Setup Signal Handlers
signal.signal(signal.SIGINT, sigint_handler)