On this page
Native desktop window via pywebview, backed by a Granian ASGI server in a daemon thread, with automatic server lifecycle and window close handling.
#src.wesktop.desktop
#src.wesktop.desktop
Native desktop window via pywebview, backed by a Granian ASGI server in a daemon thread, with automatic server lifecycle and window close handling.
#ensure_gui_backend
def ensure_gui_backend() -> boolMake pywebview's GUI backend importable in isolated venvs.
If gi (PyGObject) is not importable, searches common system site-packages locations and adds the first one found to sys.path. Returns True if a backend is available, False otherwise.
#_has_gui_backend
def _has_gui_backend() -> boolProbe whether pywebview can load a GUI backend (GTK or Qt).
Returns True if at least one backend is loadable, False otherwise. On non-Linux platforms, always returns True (pywebview uses native APIs).
#_entry_exists
def _entry_exists(name: str) -> boolCheck whether a desktop entry already exists for name on the current platform.
#_auto_register_entry
def _auto_register_entry(title: str, icon: str | None) -> NoneCreate a desktop entry for this app if one doesn't exist.
Self-heals: if an existing entry points to a missing launcher script (e.g. the package was reinstalled to a different venv), remove the broken entry so it can be recreated with the current launcher path.
#run
def run(target: str | Callable, *, title: str='wesktop', width: int=1280, height: int=800, icon: str | None=None, host: str | None=None, port: int | None=None, pid_path: Path | None=None, name: str='WESKTOP', pre_serve: Callable[[], None] | None=None, reload: bool=False, js_api: object | None=None, single_instance: bool=True) -> NoneStart server + open native desktop window. Blocks until window closes.