euporie.notebook.current.ptk_get_app

euporie.notebook.current.ptk_get_app() Application[Any]

Get the current active (running) Application. An Application is active during the Application.run_async() call.

We assume that there can only be one Application active at the same time. There is only one terminal window, with only one stdin and stdout. This makes the code significantly easier than passing around the Application everywhere.

If no Application is running, then return by default a DummyApplication. For practical reasons, we prefer to not raise an exception. This way, we don’t have to check all over the place whether an actual Application was returned.

(For applications like pymux where we can have more than one Application, we’ll use a work-around to handle that.)